[STATEMENT]
lemma mult_poly_raw_mult_poly_p:
  assumes \<open>(p, p') \<in> sorted_poly_rel\<close> and \<open>(q, q') \<in> sorted_poly_rel\<close>
  shows \<open>\<exists>r. (mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
have H: \<open>(q, q') \<in> sorted_poly_list_rel term_order \<Longrightarrow> n < length q \<Longrightarrow>
    distinct aa \<Longrightarrow> sorted_wrt var_order aa \<Longrightarrow>
    (mult_monoms aa (fst (q ! n)),
           mset (mult_monoms aa (fst (q ! n))))
          \<in> term_poly_list_rel\<close> for aa n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
using mult_monoms_spec[unfolded fun_rel_def, simplified]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel

goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply (drule bspec[of _ _ \<open>(aa, (mset aa))\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa\<rbrakk> \<Longrightarrow> (aa, mset aa) \<in> term_poly_list_rel
 2. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa; case (aa, mset aa) of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply (auto simp: term_poly_list_rel_def)[]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; n < length q; distinct aa; sorted_wrt var_order aa; case (aa, mset aa) of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
unfolding prod.case sorted_poly_list_rel_wrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> {(xs, ys). (xs, ys) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel O list_mset_rel \<and> sorted_wrt term_order (map fst xs) \<and> distinct (map fst xs) \<and> 0 \<notin># snd `# ys}; n < length q; distinct aa; sorted_wrt var_order aa; \<forall>(a, a')\<in>term_poly_list_rel. (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply (drule bspec[of _ _ \<open>(fst (q ! n), mset (fst (q ! n)))\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> (fst (q ! n), mset (fst (q ! n))) \<in> term_poly_list_rel
 2. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; case (fst (q ! n), mset (fst (q ! n))) of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
apply (cases \<open>q ! n\<close>; cases \<open>y ! n\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b aaa ba. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; q ! n = (a, b); y ! n = (aaa, ba)\<rbrakk> \<Longrightarrow> (fst (q ! n), mset (fst (q ! n))) \<in> term_poly_list_rel
 2. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; case (fst (q ! n), mset (fst (q ! n))) of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
using param_nth[of n y n q \<open>term_poly_list_rel \<times>\<^sub>r int_rel\<close>]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n < length y; (n, n) \<in> nat_rel; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel\<rbrakk> \<Longrightarrow> (q ! n, y ! n) \<in> term_poly_list_rel \<times>\<^sub>r int_rel

goal (2 subgoals):
 1. \<And>a b aaa ba. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; q ! n = (a, b); y ! n = (aaa, ba)\<rbrakk> \<Longrightarrow> (fst (q ! n), mset (fst (q ! n))) \<in> term_poly_list_rel
 2. \<lbrakk>n < length q; distinct aa; sorted_wrt var_order aa; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; case (fst (q ! n), mset (fst (q ! n))) of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> (mult_monoms aa (fst (q ! n)), mset (mult_monoms aa (fst (q ! n)))) \<in> term_poly_list_rel
[PROOF STEP]
by (auto simp: list_rel_imp_same_length term_poly_list_rel_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>(q, q') \<in> sorted_poly_rel; ?n < length q; distinct ?aa; sorted_wrt var_order ?aa\<rbrakk> \<Longrightarrow> (mult_monoms ?aa (fst (q ! ?n)), mset (mult_monoms ?aa (fst (q ! ?n)))) \<in> term_poly_list_rel

goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
have H': \<open>(q, q') \<in> sorted_poly_list_rel term_order \<Longrightarrow>
    distinct aa \<Longrightarrow> sorted_wrt var_order aa \<Longrightarrow>
     (ab, ba) \<in> set q \<Longrightarrow>
       remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)\<close> for aa n ab ba
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
using mult_monoms_spec[unfolded fun_rel_def, simplified]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel

goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply (drule bspec[of _ _ \<open>(aa, (mset aa))\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q\<rbrakk> \<Longrightarrow> (aa, mset aa) \<in> term_poly_list_rel
 2. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; case (aa, mset aa) of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply (auto simp: term_poly_list_rel_def)[]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; case (aa, mset aa) of (a, a') \<Rightarrow> \<forall>x\<in>term_poly_list_rel. case x of (aa, a'a) \<Rightarrow> (mult_monoms a aa, remdups_mset (a' + a'a)) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
unfolding prod.case sorted_poly_list_rel_wrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> {(xs, ys). (xs, ys) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel O list_mset_rel \<and> sorted_wrt term_order (map fst xs) \<and> distinct (map fst xs) \<and> 0 \<notin># snd `# ys}; distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; \<forall>(a, a')\<in>term_poly_list_rel. (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; \<forall>x\<in>term_poly_list_rel. case x of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply (drule bspec[of _ _ \<open>(ab, mset ab)\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'\<rbrakk> \<Longrightarrow> (ab, mset ab) \<in> term_poly_list_rel
 2. \<lbrakk>distinct aa; sorted_wrt var_order aa; (ab, ba) \<in> set q; (q, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, q') \<in> list_mset_rel; sorted_wrt term_order (map fst q); distinct (map fst q); 0 \<notin> snd ` set_mset q'; case (ab, mset ab) of (a, a') \<Rightarrow> (mult_monoms aa a, remdups_mset (mset aa + a')) \<in> term_poly_list_rel\<rbrakk> \<Longrightarrow> remdups_mset (mset aa + mset ab) = mset (mult_monoms aa ab)
[PROOF STEP]
apply (auto simp: list_rel_imp_same_length term_poly_list_rel_def list_rel_def
        dest: list_all2_in_set_ExD)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>(q, q') \<in> sorted_poly_rel; distinct ?aa; sorted_wrt var_order ?aa; (?ab, ?ba) \<in> set q\<rbrakk> \<Longrightarrow> remdups_mset (mset ?aa + mset ?ab) = mset (mult_monoms ?aa ?ab)

goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
have  H: \<open>(q, q') \<in> sorted_poly_list_rel term_order \<Longrightarrow>
       a = (aa, b) \<Longrightarrow>
       (pq, r) \<in> unsorted_poly_rel \<Longrightarrow>
       p' = add_mset (mset aa, b) A \<Longrightarrow>
       \<forall>x\<in>set p. term_order aa (fst x) \<Longrightarrow>
       sorted_wrt var_order aa \<Longrightarrow>
       distinct aa \<Longrightarrow> b\<noteq> 0 \<Longrightarrow>
       (\<And>aaa. (aaa, 0) \<notin># q') \<Longrightarrow>
       (pq @
        map (mult_monomials (aa, b)) q,
        {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b)
        . x \<in># q'#} +
        r)
       \<in> unsorted_poly_rel\<close> for a p p' pq aa b r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (pq, r) \<in> unsorted_poly_rel; p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'\<rbrakk> \<Longrightarrow> (pq @ map (mult_monomials (aa, b)) q, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r) \<in> unsorted_poly_rel
[PROOF STEP]
apply (auto simp: poly_list_rel_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set_mset r; (pq, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, r) \<in> list_mset_rel\<rbrakk> \<Longrightarrow> (pq @ map (mult_monomials (aa, b)) q, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel O list_mset_rel
[PROOF STEP]
apply (rule_tac b = \<open>y @ map (\<lambda>(a,b). (mset a, b)) (map (mult_monomials (aa, b)) q)\<close> in relcompI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set_mset r; (pq, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, r) \<in> list_mset_rel\<rbrakk> \<Longrightarrow> (pq @ map (mult_monomials (aa, b)) q, y @ map (\<lambda>(a, b). (mset a, b)) (map (mult_monomials (aa, b)) q)) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel
 2. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set_mset r; (pq, y) \<in> \<langle>term_poly_list_rel \<times>\<^sub>r int_rel\<rangle>list_rel; (y, r) \<in> list_mset_rel\<rbrakk> \<Longrightarrow> (y @ map (\<lambda>(a, b). (mset a, b)) (map (mult_monomials (aa, b)) q), {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r) \<in> list_mset_rel
[PROOF STEP]
apply (auto simp: list_rel_def list_all2_append list_all2_lengthD H
     list_mset_rel_def br_def mult_monomials_def case_prod_beta intro!: list_all2_all_nthI
     simp: sorted_poly_list_relD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set y; list_all2 (\<lambda>x x'. (x, x') \<in> term_poly_list_rel \<times>\<^sub>r int_rel) pq y; r = mset y\<rbrakk> \<Longrightarrow> {#(remdups_mset (mset aa + fst x), snd x * b). x \<in># q'#} = {#(mset (mult_monoms aa (fst x)), b * snd x). x \<in># mset q#}
[PROOF STEP]
apply (subst sorted_poly_list_relD[of q q' term_order])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set y; list_all2 (\<lambda>x x'. (x, x') \<in> term_poly_list_rel \<times>\<^sub>r int_rel) pq y; r = mset y\<rbrakk> \<Longrightarrow> (q, q') \<in> sorted_poly_rel
 2. \<And>y. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'; 0 \<notin> snd ` set y; list_all2 (\<lambda>x x'. (x, x') \<in> term_poly_list_rel \<times>\<^sub>r int_rel) pq y; r = mset y\<rbrakk> \<Longrightarrow> {#(remdups_mset (mset aa + fst x), snd x * b). x \<in># {#(mset a, y). (a, y) \<in># mset q#}#} = {#(mset (mult_monoms aa (fst x)), b * snd x). x \<in># mset q#}
[PROOF STEP]
apply (auto simp: case_prod_beta H' intro!: image_mset_cong)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>(q, q') \<in> sorted_poly_rel; ?a = (?aa, ?b); (?pq, ?r) \<in> unsorted_poly_rel; ?p' = add_mset (mset ?aa, ?b) A; \<forall>x\<in>set ?p. term_order ?aa (fst x); sorted_wrt var_order ?aa; distinct ?aa; ?b \<noteq> 0; \<And>aaa. (aaa, 0) \<notin># q'\<rbrakk> \<Longrightarrow> (?pq @ map (mult_monomials (?aa, ?b)) q, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset ?aa + ys), n * ?b). x \<in># q'#} + ?r) \<in> unsorted_poly_rel

goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(p, p') \<in> sorted_poly_rel
(q, q') \<in> sorted_poly_rel

goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
apply (induction p arbitrary: p')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p'. \<lbrakk>([], p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw [] q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
 2. \<And>a p p'. \<lbrakk>\<And>p'. \<lbrakk>(p, p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r); (a # p, p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw (a # p) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>([], p'_) \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw [] q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p'_, {#}) ({#}, r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p p'. \<lbrakk>\<And>p'. \<lbrakk>(p, p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r); (a # p, p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw (a # p) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
subgoal premises p for a p p'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw (a # p) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
using p(1)[of \<open>remove1_mset (mset (fst a), snd a) p'\<close>] p(2-)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(p, remove1_mset (mset (fst a), snd a) p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (remove1_mset (mset (fst a), snd a) p', {#}) ({#}, r)
(a # p, p') \<in> sorted_poly_rel
(q, q') \<in> sorted_poly_rel

goal (1 subgoal):
 1. \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw (a # p) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
apply (cases a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b. \<lbrakk>\<lbrakk>(p, remove1_mset (mset (fst a), snd a) p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (remove1_mset (mset (fst a), snd a) p', {#}) ({#}, r); (a # p, p') \<in> sorted_poly_rel; (q, q') \<in> sorted_poly_rel; a = (aa, b)\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw (a # p) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)
[PROOF STEP]
apply (auto simp: sorted_poly_list_rel_Cons_iff
        dest!: multi_member_split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> \<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q @ map (mult_monomials (aa, b)) q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (add_mset (mset aa, b) A, {#}) ({#}, r)
[PROOF STEP]
apply (rule_tac x = \<open>(\<lambda>(ys, n). (remdups_mset (mset (fst a) + ys), n * snd a)) `# q' + r\<close> in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (PAC_Polynomials_Operations.mult_poly_raw p q @ map (mult_monomials (aa, b)) q, {#(remdups_mset (mset (fst a) + ys), n * snd a). (ys, n) \<in># q'#} + r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (add_mset (mset aa, b) A, {#}) ({#}, {#(remdups_mset (mset (fst a) + ys), n * snd a). (ys, n) \<in># q'#} + r)
[PROOF STEP]
apply (auto 5 3 intro: mult_poly_p.intros simp: intro!: H
        dest: sorted_poly_list_rel_nonzeroD nonzero_coeffsD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (add_mset (mset aa, b) A, {#}) ({#}, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r)
[PROOF STEP]
apply (rule rtranclp_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (add_mset (mset aa, b) A, {#}) (?y143 aa b r A)
 2. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (?y143 aa b r A) ({#}, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r)
[PROOF STEP]
apply (rule mult_poly_p_add_mset_same)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) (?B146 aa b r A, ?r'146 aa b r A)
 2. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (add_mset (mset aa, b) (?B146 aa b r A), ?r'146 aa b r A) ({#}, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* ({#(mset aa, b)#}, r) ({#}, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r)
[PROOF STEP]
apply (rule converse_rtranclp_into_rtranclp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> mult_poly_p q' ({#(mset aa, b)#}, r) (?b148 aa b r A)
 2. \<And>aa b r A. \<lbrakk>(q, q') \<in> sorted_poly_rel; a = (aa, b); (p, A) \<in> sorted_poly_rel; (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel; (mult_poly_p q')\<^sup>*\<^sup>* (A, {#}) ({#}, r); p' = add_mset (mset aa, b) A; \<forall>x\<in>set p. term_order aa (fst x); sorted_wrt var_order aa; distinct aa; aa \<notin> fst ` set p; b \<noteq> 0; nonzero_coeffs A\<rbrakk> \<Longrightarrow> (mult_poly_p q')\<^sup>*\<^sup>* (?b148 aa b r A) ({#}, {#case x of (ys, n) \<Rightarrow> (remdups_mset (mset aa + ys), n * b). x \<in># q'#} + r)
[PROOF STEP]
apply (auto intro!: mult_poly_p.intros simp: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>r. (PAC_Polynomials_Operations.mult_poly_raw p q, r) \<in> unsorted_poly_rel \<and> (mult_poly_p q')\<^sup>*\<^sup>* (p', {#}) ({#}, r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma incseq_def: "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<ge> X m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq X = (\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x \<le> y \<longrightarrow> X x \<le> X y) = (\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n)
[PROOF STEP]
..


[STATEMENT]
lemma Inl_qbs_morphism:
  "Inl \<in> X \<rightarrow>\<^sub>Q X <+>\<^sub>Q Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inl \<in> X \<rightarrow>\<^sub>Q X <+>\<^sub>Q Y
[PROOF STEP]
proof(rule qbs_morphismI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
fix \<alpha>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
assume "\<alpha> \<in> qbs_Mx X"
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> qbs_Mx X

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> qbs_Mx X

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
have "Inl \<circ> \<alpha> = (\<lambda>r. Inl (\<alpha> r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inl \<circ> \<alpha> = (\<lambda>r. Inl (\<alpha> r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inl \<circ> \<alpha> = (\<lambda>r. Inl (\<alpha> r))

goal (1 subgoal):
 1. \<And>\<alpha>. \<alpha> \<in> qbs_Mx X \<Longrightarrow> Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<alpha> \<in> qbs_Mx X
Inl \<circ> \<alpha> = (\<lambda>r. Inl (\<alpha> r))
[PROOF STEP]
show "Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)"
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> qbs_Mx X
Inl \<circ> \<alpha> = (\<lambda>r. Inl (\<alpha> r))

goal (1 subgoal):
 1. Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)
[PROOF STEP]
by(auto simp add: copair_qbs_Mx_def)
[PROOF STATE]
proof (state)
this:
Inl \<circ> \<alpha> \<in> qbs_Mx (X <+>\<^sub>Q Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ocircline_set_ounit_circle [simp]:
  shows "ocircline_set ounit_circle = circline_set unit_circle"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ocircline_set ounit_circle = circline_set unit_circle
[PROOF STEP]
apply (subst of_circline_unit_circle[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ocircline_set (of_circline unit_circle) = circline_set unit_circle
[PROOF STEP]
apply (subst ocircline_set_of_circline)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_set unit_circle = circline_set unit_circle
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zero_le_Fract_iff: "0 < b \<Longrightarrow> 0 \<le> Fract a b \<longleftrightarrow> 0 \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < b \<Longrightarrow> (0 \<le> Fract a b) = ((0::'a) \<le> a)
[PROOF STEP]
by (auto simp add: Zero_fract_def zero_le_mult_iff)


[STATEMENT]
lemma a_l_coset_def':
  fixes G (structure)
  shows "a <+ H \<equiv> \<Union>h\<in>H. {a \<oplus> h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a <+ H \<equiv> \<Union>h\<in>H. {a \<oplus> h}
[PROOF STEP]
unfolding a_l_coset_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union>h\<in>H. {a \<otimes>\<^bsub>add_monoid G\<^esub> h} \<equiv> \<Union>h\<in>H. {a \<oplus> h}
[PROOF STEP]
by simp


[STATEMENT]
lemma atomize_minus: "atomize_poly (p - q) = atomize_poly p - atomize_poly q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atomize_poly (p - q) = atomize_poly p - atomize_poly q
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_atomize_poly lookup_minus)


[STATEMENT]
lemma select_index_union:
  "{k| k::nat. select_index n i k} \<union> {k| k::nat. (k<2^n) \<and> \<not> select_index n i k} = {0..<2^n::nat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} = {0..<2 ^ n}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
 2. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
have "{k |k. select_index n i k} \<subseteq> {0..<2 ^ n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k |k. select_index n i k} \<subseteq> {0..<2 ^ n}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {k |k. select_index n i k} \<Longrightarrow> x \<in> {0..<2 ^ n}
[PROOF STEP]
fix x::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {k |k. select_index n i k} \<Longrightarrow> x \<in> {0..<2 ^ n}
[PROOF STEP]
assume "x \<in> {k |k. select_index n i k}"
[PROOF STATE]
proof (state)
this:
x \<in> {k |k. select_index n i k}

goal (1 subgoal):
 1. \<And>x. x \<in> {k |k. select_index n i k} \<Longrightarrow> x \<in> {0..<2 ^ n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {k |k. select_index n i k}
[PROOF STEP]
show "x \<in> {0..<2^n}"
[PROOF STATE]
proof (prove)
using this:
x \<in> {k |k. select_index n i k}

goal (1 subgoal):
 1. x \<in> {0..<2 ^ n}
[PROOF STEP]
using select_index_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {k |k. select_index n i k}
select_index ?n ?i ?j \<equiv> ?i \<le> ?n - 1 \<and> ?j \<le> 2 ^ ?n - 1 \<and> 2 ^ (?n - 1 - ?i) \<le> ?j mod 2 ^ (?n - ?i)

goal (1 subgoal):
 1. x \<in> {0..<2 ^ n}
[PROOF STEP]
by (metis (no_types, lifting) atLeastLessThan_iff diff_diff_cancel diff_is_0_eq' diff_le_mono2
le_less_linear le_numeral_extra(2) mem_Collect_eq one_le_numeral one_le_power select_index_def zero_order(1))
[PROOF STATE]
proof (state)
this:
x \<in> {0..<2 ^ n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{k |k. select_index n i k} \<subseteq> {0..<2 ^ n}

goal (2 subgoals):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
 2. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{k |k. select_index n i k} \<subseteq> {0..<2 ^ n}

goal (2 subgoals):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
 2. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
have "{k |k. k<2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}

goal (2 subgoals):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
 2. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{k |k. select_index n i k} \<subseteq> {0..<2 ^ n}
{k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
[PROOF STEP]
show "{k |k. select_index n i k} \<union> {k |k. k<2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}"
[PROOF STATE]
proof (prove)
using this:
{k |k. select_index n i k} \<subseteq> {0..<2 ^ n}
{k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}

goal (1 subgoal):
 1. {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k} \<subseteq> {0..<2 ^ n}

goal (1 subgoal):
 1. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
show "{0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k<2 ^ n \<and> \<not> select_index n i k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<2 ^ n} \<subseteq> {k |k. select_index n i k} \<union> {k |k. k < 2 ^ n \<and> \<not> select_index n i k}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coprime_iff_invertible_int:
  "coprime a m \<longleftrightarrow> (\<exists>x. [a * x = 1] (mod m))" (is "?P \<longleftrightarrow> ?Q") for m :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a m = (\<exists>x. [a * x = 1] (mod m))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. coprime a m \<Longrightarrow> \<exists>x. [a * x = 1] (mod m)
 2. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
assume ?P
[PROOF STATE]
proof (state)
this:
coprime a m

goal (2 subgoals):
 1. coprime a m \<Longrightarrow> \<exists>x. [a * x = 1] (mod m)
 2. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime a m
[PROOF STEP]
show ?Q
[PROOF STATE]
proof (prove)
using this:
coprime a m

goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod m)
[PROOF STEP]
by (auto dest: cong_solve_coprime_int)
[PROOF STATE]
proof (state)
this:
\<exists>x. [a * x = 1] (mod m)

goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
assume ?Q
[PROOF STATE]
proof (state)
this:
\<exists>x. [a * x = 1] (mod m)

goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. [a * x = 1] (mod m)
[PROOF STEP]
obtain b where "[a * b = 1] (mod m)"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. [a * x = 1] (mod m)

goal (1 subgoal):
 1. (\<And>b. [a * b = 1] (mod m) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[a * b = 1] (mod m)

goal (1 subgoal):
 1. \<exists>x. [a * x = 1] (mod m) \<Longrightarrow> coprime a m
[PROOF STEP]
with coprime_mod_left_iff [of m "a * b"]
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> 0 \<Longrightarrow> coprime (a * b mod m) m = coprime (a * b) m
[a * b = 1] (mod m)
[PROOF STEP]
show ?P
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0 \<Longrightarrow> coprime (a * b mod m) m = coprime (a * b) m
[a * b = 1] (mod m)

goal (1 subgoal):
 1. coprime a m
[PROOF STEP]
by (cases "m = 0 \<or> m = 1")
      (unfold cong_def, auto simp add: zmult_eq_1_iff)
[PROOF STATE]
proof (state)
this:
coprime a m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compl_inter_eq_pp:
  "--x \<sqinter> y = --x \<sqinter> z \<Longrightarrow> -x \<sqinter> y = -x \<sqinter> z \<Longrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- - x \<sqinter> y = - - x \<sqinter> z; - x \<sqinter> y = - x \<sqinter> z\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
by (metis inf_commute inf_p inf_sup_distrib1 inf_top.right_neutral p_bot p_dist_inf)


[STATEMENT]
lemma rows_transpose [simp]: "rows(transpose A) = columns A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rows (Finite_Cartesian_Product.transpose A) = columns A
[PROOF STEP]
by (auto simp add: rows_def columns_def intro: set_eqI)


[STATEMENT]
lemma ln_2_ge: "ln 2 \<ge> (5677 / 8192 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
have "ln 2 \<ge> real_of_float (lb_ln2 12)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (lb_ln2 12) \<le> ln 2
[PROOF STEP]
by (rule lb_ln2)
[PROOF STATE]
proof (state)
this:
real_of_float (lb_ln2 12) \<le> ln 2

goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_float (lb_ln2 12) \<le> ln 2

goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
have "lb_ln2 12 = Float 5677 (-13)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lb_ln2 12 = Float 5677 (- 13)
[PROOF STEP]
by code_simp
[PROOF STATE]
proof (state)
this:
lb_ln2 12 = Float 5677 (- 13)

goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_float (Float 5677 (- 13)) \<le> ln 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_float (Float 5677 (- 13)) \<le> ln 2

goal (1 subgoal):
 1. 5677 / 8192 \<le> ln 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
5677 / 8192 \<le> ln 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_int_encode: "surj int_encode"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj int_encode
[PROOF STEP]
by (rule surjI) (rule int_decode_inverse)


[STATEMENT]
lemma rtrancl_into_trancl3: "\<lbrakk>(a, b) \<in> r\<^sup>*; a \<noteq> b\<rbrakk> \<Longrightarrow> (a, b) \<in> r\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> r\<^sup>*; a \<noteq> b\<rbrakk> \<Longrightarrow> (a, b) \<in> r\<^sup>+
[PROOF STEP]
apply (drule rtranclD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> b; a = b \<or> a \<noteq> b \<and> (a, b) \<in> r\<^sup>+\<rbrakk> \<Longrightarrow> (a, b) \<in> r\<^sup>+
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma excess_nodes_only: "excess f v > 0 \<Longrightarrow> v \<in> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'capacity) < excess f v \<Longrightarrow> v \<in> V
[PROOF STEP]
unfolding excess_def incoming_def outgoing_def V_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'capacity) < sum f {(u, v) |u. (u, v) \<in> E} - sum f {(v, u) |u. (v, u) \<in> E} \<Longrightarrow> v \<in> {u. \<exists>v. (u, v) \<in> E \<or> (v, u) \<in> E}
[PROOF STEP]
using sum.not_neutral_contains_not_neutral
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sum ?g ?A \<noteq> (0::?'a); \<And>a. \<lbrakk>a \<in> ?A; ?g a \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (0::'capacity) < sum f {(u, v) |u. (u, v) \<in> E} - sum f {(v, u) |u. (v, u) \<in> E} \<Longrightarrow> v \<in> {u. \<exists>v. (u, v) \<in> E \<or> (v, u) \<in> E}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma norm_adj[simp]: \<open>norm (A*) = norm A\<close>
  for A :: \<open>'b::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_inner\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (A*) = norm A
[PROOF STEP]
proof (cases \<open>(\<exists>x y :: 'b. x \<noteq> y) \<and> (\<exists>x y :: 'c. x \<noteq> y)\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
(\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)
[PROOF STEP]
have c1: \<open>class.not_singleton TYPE('b)\<close>
[PROOF STATE]
proof (prove)
using this:
(\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)

goal (1 subgoal):
 1. class.not_singleton TYPE('b)
[PROOF STEP]
apply intro_classes
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> \<exists>x y. x \<noteq> y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
class.not_singleton TYPE('b)

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
(\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)
[PROOF STEP]
have c2: \<open>class.not_singleton TYPE('c)\<close>
[PROOF STATE]
proof (prove)
using this:
(\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)

goal (1 subgoal):
 1. class.not_singleton TYPE('c)
[PROOF STEP]
apply intro_classes
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> \<exists>x y. x \<noteq> y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
class.not_singleton TYPE('c)

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have normA: \<open>norm A = (SUP (\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm A = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (rule cinner_sup_norm_cblinfun[internalize_sort \<open>'a::{complex_normed_vector,not_singleton}\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. class.complex_normed_vector (*\<^sub>R) (*\<^sub>C) (+) (0::'b) (-) uminus dist norm sgn uniformity open
 2. class.not_singleton TYPE('b)
[PROOF STEP]
apply (rule complex_normed_vector_axioms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.not_singleton TYPE('b)
[PROOF STEP]
by (rule c1)
[PROOF STATE]
proof (state)
this:
norm A = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have normAadj: \<open>norm (A*) = (SUP (\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A* *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (A*) = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A* *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (rule cinner_sup_norm_cblinfun[internalize_sort \<open>'a::{complex_normed_vector,not_singleton}\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. class.complex_normed_vector (*\<^sub>R) (*\<^sub>C) (+) (0::'c) (-) uminus dist norm sgn uniformity open
 2. class.not_singleton TYPE('c)
[PROOF STEP]
apply (rule complex_normed_vector_axioms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.not_singleton TYPE('c)
[PROOF STEP]
by (rule c2)
[PROOF STATE]
proof (state)
this:
norm (A*) = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A* *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have \<open>norm (A*) = (SUP (\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (A*) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
unfolding normAadj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A* *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (subst cinner_adj_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>). cmod ((A *\<^sub>V \<psi>) \<bullet>\<^sub>C \<phi>) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (subst cinner_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>). cmod (cnj (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>))) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (subst complex_mod_cnj)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
norm (A*) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (A*) = (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have \<open>\<dots> = Sup ((\<lambda>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) ` prod.swap ` UNIV)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Squnion>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have \<open>\<dots> = (SUP (\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
apply (subst image_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>x. case prod.swap x of (\<psi>, \<phi>) \<Rightarrow> cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Squnion>(\<psi>, \<phi>)\<in>range prod.swap. cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
have \<open>\<dots> = norm A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = norm A
[PROOF STEP]
unfolding normA
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = (\<Squnion>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
(\<Squnion>(\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) = norm A

goal (2 subgoals):
 1. (\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y) \<Longrightarrow> norm (A*) = norm A
 2. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (A*) = norm A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (A*) = norm A

goal (1 subgoal):
 1. norm (A*) = norm A
[PROOF STEP]
by -
[PROOF STATE]
proof (state)
this:
norm (A*) = norm A

goal (1 subgoal):
 1. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y))

goal (1 subgoal):
 1. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y))
[PROOF STEP]
consider (b) \<open>\<And>x::'b. x = 0\<close> | (c) \<open>\<And>x::'c. x = 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y))

goal (1 subgoal):
 1. \<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> ?thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> ?thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
have \<open>A = 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> ?thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. A = 0
[PROOF STEP]
apply (cases; transfer)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>\<And>x. x = (0::'b); \<And>thesis. \<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis; bounded_clinear A\<rbrakk> \<Longrightarrow> A = (\<lambda>x. 0::'c)
 2. \<And>A. \<lbrakk>\<And>x. x = (0::'c); \<And>thesis. \<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis; bounded_clinear A\<rbrakk> \<Longrightarrow> A = (\<lambda>x. 0::'c)
[PROOF STEP]
apply (metis (full_types) bounded_clinear_def complex_vector.linear_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>\<And>x. x = (0::'c); \<And>thesis. \<lbrakk>(\<And>x. x = (0::'b)) \<Longrightarrow> thesis; (\<And>x. x = (0::'c)) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis; bounded_clinear A\<rbrakk> \<Longrightarrow> A = (\<lambda>x. 0::'c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = 0

goal (1 subgoal):
 1. \<not> ((\<exists>x y. x \<noteq> y) \<and> (\<exists>x y. x \<noteq> y)) \<Longrightarrow> norm (A*) = norm A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = 0
[PROOF STEP]
show \<open>norm (A*) = norm A\<close>
[PROOF STATE]
proof (prove)
using this:
A = 0

goal (1 subgoal):
 1. norm (A*) = norm A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (A*) = norm A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma harm_ge_ln: "harm n \<ge> ln (real n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
have "ln (n + 1) = (\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (n + 1)) = (\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1)))
[PROOF STEP]
by (subst sum_lessThan_telescope) auto
[PROOF STATE]
proof (state)
this:
ln (real (n + 1)) = (\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1)))

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (n + 1)) = (\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1)))

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
have "\<dots> \<le> (\<Sum>j<n. 1 / (Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1))) \<le> (\<Sum>j<n. 1 / real (Suc j))
[PROOF STEP]
proof (intro sum_mono, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
assume j: "j < n"
[PROOF STATE]
proof (state)
this:
j < n

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
have "\<exists>\<xi>. \<xi> > real j + 1 \<and> \<xi> < real j + 2 \<and>
            ln (real j + 2) - ln (real j + 1) = (real j + 2 - (real j + 1)) * (1 / \<xi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<xi>>real j + 1. \<xi> < real j + 2 \<and> ln (real j + 2) - ln (real j + 1) = (real j + 2 - (real j + 1)) * (1 / \<xi>)
[PROOF STEP]
by (intro MVT2) (auto intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
\<exists>\<xi>>real j + 1. \<xi> < real j + 2 \<and> ln (real j + 2) - ln (real j + 1) = (real j + 2 - (real j + 1)) * (1 / \<xi>)

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<xi>>real j + 1. \<xi> < real j + 2 \<and> ln (real j + 2) - ln (real j + 1) = (real j + 2 - (real j + 1)) * (1 / \<xi>)
[PROOF STEP]
obtain \<xi> :: real
      where \<xi>: "\<xi> \<in> {real j + 1..real j + 2}" "ln (real j + 2) - ln (real j + 1) = 1 / \<xi>"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<xi>>real j + 1. \<xi> < real j + 2 \<and> ln (real j + 2) - ln (real j + 1) = (real j + 2 - (real j + 1)) * (1 / \<xi>)

goal (1 subgoal):
 1. (\<And>\<xi>. \<lbrakk>\<xi> \<in> {real j + 1..real j + 2}; ln (real j + 2) - ln (real j + 1) = 1 / \<xi>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<xi> \<in> {real j + 1..real j + 2}
ln (real j + 2) - ln (real j + 1) = 1 / \<xi>

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
note \<xi>(2)
[PROOF STATE]
proof (state)
this:
ln (real j + 2) - ln (real j + 1) = 1 / \<xi>

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real j + 2) - ln (real j + 1) = 1 / \<xi>

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
have "1 / \<xi> \<le> 1 / (Suc j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / \<xi> \<le> 1 / real (Suc j)
[PROOF STEP]
using \<xi>(1)
[PROOF STATE]
proof (prove)
using this:
\<xi> \<in> {real j + 1..real j + 2}

goal (1 subgoal):
 1. 1 / \<xi> \<le> 1 / real (Suc j)
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
1 / \<xi> \<le> 1 / real (Suc j)

goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (real j + 2) - ln (real j + 1) \<le> 1 / real (Suc j)
[PROOF STEP]
show "ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / (Suc j)"
[PROOF STATE]
proof (prove)
using this:
ln (real j + 2) - ln (real j + 1) \<le> 1 / real (Suc j)

goal (1 subgoal):
 1. ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
ln (real (Suc j + 1)) - ln (real (j + 1)) \<le> 1 / real (Suc j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1))) \<le> (\<Sum>j<n. 1 / real (Suc j))

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j<n. ln (real (Suc j + 1)) - ln (real (j + 1))) \<le> (\<Sum>j<n. 1 / real (Suc j))

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
have "\<dots> = harm n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<n. 1 / real (Suc j)) = harm n
[PROOF STEP]
by (simp add: harm_altdef field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>j<n. 1 / real (Suc j)) = harm n

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (real (n + 1)) \<le> harm n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (real (n + 1)) \<le> harm n

goal (1 subgoal):
 1. ln (real n + 1) \<le> harm n
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
ln (real n + 1) \<le> harm n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padic_set_zero_res:
  assumes "prime p"
  assumes "f \<in> (padic_set p)"
  shows "f 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
have "f 0 \<in> carrier (residue_ring 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 \<in> carrier (residue_ring 1)
[PROOF STEP]
using assms(1) padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
prime p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. f 0 \<in> carrier (residue_ring 1)
[PROOF STEP]
by (metis assms(2)  power_0)
[PROOF STATE]
proof (state)
this:
f 0 \<in> carrier (residue_ring 1)

goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f 0 \<in> carrier (residue_ring 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f 0 \<in> carrier (residue_ring 1)

goal (1 subgoal):
 1. f 0 = 0
[PROOF STEP]
using residue_ring_def
[PROOF STATE]
proof (prove)
using this:
f 0 \<in> carrier (residue_ring 1)
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_leqb_eqc_correct:
  assumes "dim_vec c = dim_row A\<^sup>T"
    and "dim_vec b = dim_col A\<^sup>T"
  assumes "simplex (mat_leqb_eqc A b c) = Sat X"
  assumes "(x, y) = split_n_m_x (dim_row A\<^sup>T) (dim_col A\<^sup>T) X"
  shows "[y \<^sub>v* A]=c" "[A *\<^sub>v x]\<le>b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y\<^sub>v*A]=c &&& [A*\<^sub>vx]\<le>b
[PROOF STEP]
using mat_leqb_eqc_split_simplex_correct1[of b A c X x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_vec b = dim_row A; simplex (mat_leqb_eqc A b c) = Inr X; (x, y) = split_i_j_x (dim_col A) ?l X\<rbrakk> \<Longrightarrow> [A*\<^sub>vx]\<le>b

goal (1 subgoal):
 1. [y\<^sub>v*A]=c &&& [A*\<^sub>vx]\<le>b
[PROOF STEP]
using assms(1) assms(2) assms(3) assms(4) mat_leqb_eqc_split_simplex_correct2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_vec b = dim_row A; simplex (mat_leqb_eqc A b c) = Inr X; (x, y) = split_i_j_x (dim_col A) ?l X\<rbrakk> \<Longrightarrow> [A*\<^sub>vx]\<le>b
dim_vec c = dim_row A\<^sup>T
dim_vec b = dim_col A\<^sup>T
simplex (mat_leqb_eqc A b c) = Inr X
(x, y) = split_n_m_x (dim_row A\<^sup>T) (dim_col A\<^sup>T) X
\<lbrakk>dim_vec ?c = dim_row ?A\<^sup>T; dim_vec ?b = dim_col ?A\<^sup>T; simplex (mat_leqb_eqc ?A ?b ?c) = Inr ?X; (?x, ?y) = split_n_m_x (dim_row ?A\<^sup>T) (dim_col ?A\<^sup>T) ?X\<rbrakk> \<Longrightarrow> [?y\<^sub>v*?A]=?c

goal (1 subgoal):
 1. [y\<^sub>v*A]=c &&& [A*\<^sub>vx]\<le>b
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [A*\<^sub>vx]\<le>b
[PROOF STEP]
using mat_leqb_eqc_split_correct2[of b A c X x y]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_vec b = dim_row A\<^sup>T; dim_vec c = dim_col A\<^sup>T; \<langle>X\<rangle> \<Turnstile>\<^sub>c\<^sub>s set (mat_leqb_eqc A c b); (x, y) = split_n_m_x (dim_row A\<^sup>T) (dim_col A\<^sup>T) X\<rbrakk> \<Longrightarrow> [y\<^sub>v*A]=b

goal (1 subgoal):
 1. [A*\<^sub>vx]\<le>b
[PROOF STEP]
by (metis (no_types) Matrix.transpose_transpose assms(2) assms(3) assms(4) index_transpose_mat(3)
      mat_leqb_eqc_split_simplex_correct1[of b A c X x y])


[STATEMENT]
lemma bigo_mult5:
  fixes f :: "'a \<Rightarrow> 'b::linordered_field"
  assumes "\<forall>x. f x \<noteq> 0"
  shows "O(f * g) \<subseteq> f *o O(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O(f * g) \<subseteq> f *o O(g)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
fix h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
assume "h \<in> O(f * g)"
[PROOF STATE]
proof (state)
this:
h \<in> O(f * g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h \<in> O(f * g)
[PROOF STEP]
have "(\<lambda>x. 1 / (f x)) * h \<in> (\<lambda>x. 1 / f x) *o O(f * g)"
[PROOF STATE]
proof (prove)
using this:
h \<in> O(f * g)

goal (1 subgoal):
 1. (\<lambda>x. (1::'b) / f x) * h \<in> (\<lambda>x. (1::'b) / f x) *o O(f * g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) * h \<in> (\<lambda>x. (1::'b) / f x) *o O(f * g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) * h \<in> (\<lambda>x. (1::'b) / f x) *o O(f * g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
have "\<dots> \<subseteq> O((\<lambda>x. 1 / f x) * (f * g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1::'b) / f x) *o O(f * g) \<subseteq> O((\<lambda>x. (1::'b) / f x) * (f * g))
[PROOF STEP]
by (rule bigo_mult2)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) *o O(f * g) \<subseteq> O((\<lambda>x. (1::'b) / f x) * (f * g))

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) *o O(f * g) \<subseteq> O((\<lambda>x. (1::'b) / f x) * (f * g))

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
have "(\<lambda>x. 1 / f x) * (f * g) = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (1::'b) / f x) * (f * g) = g
[PROOF STEP]
apply (simp add: func_times)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if f x = (0::'b) then 0::'b else g x) = g
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (if f x = (0::'b) then 0::'b else g x) = g x
[PROOF STEP]
apply (simp add: assms nonzero_divide_eq_eq ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) * (f * g) = g

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. (1::'b) / f x) * h \<in> O(g)
[PROOF STEP]
have "(\<lambda>x. (1::'b) / f x) * h \<in> O(g)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (1::'b) / f x) * h \<in> O(g)

goal (1 subgoal):
 1. (\<lambda>x. (1::'b) / f x) * h \<in> O(g)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (1::'b) / f x) * h \<in> O(g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. (1::'b) / f x) * h \<in> O(g)
[PROOF STEP]
have "f * ((\<lambda>x. (1::'b) / f x) * h) \<in> f *o O(g)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. (1::'b) / f x) * h \<in> O(g)

goal (1 subgoal):
 1. f * ((\<lambda>x. (1::'b) / f x) * h) \<in> f *o O(g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f * ((\<lambda>x. (1::'b) / f x) * h) \<in> f *o O(g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f * ((\<lambda>x. (1::'b) / f x) * h) \<in> f *o O(g)

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
have "f * ((\<lambda>x. (1::'b) / f x) * h) = h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * ((\<lambda>x. (1::'b) / f x) * h) = h
[PROOF STEP]
apply (simp add: func_times)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if f x = (0::'b) then 0::'b else h x) = h
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (if f x = (0::'b) then 0::'b else h x) = h x
[PROOF STEP]
apply (simp add: assms nonzero_divide_eq_eq ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
f * ((\<lambda>x. (1::'b) / f x) * h) = h

goal (1 subgoal):
 1. \<And>x. x \<in> O(f * g) \<Longrightarrow> x \<in> f *o O(g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h \<in> f *o O(g)
[PROOF STEP]
show "h \<in> f *o O(g)"
[PROOF STATE]
proof (prove)
using this:
h \<in> f *o O(g)

goal (1 subgoal):
 1. h \<in> f *o O(g)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
h \<in> f *o O(g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccSup_mono:
  assumes [intro]: "countable B" "countable A"
  assumes "\<And>a. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a \<le> b"
  shows "Sup A \<le> Sup B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup A \<le> Sup B
[PROOF STEP]
proof (rule ccSup_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable A
 2. \<And>x. x \<in> A \<Longrightarrow> x \<le> Sup B
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable A
 2. \<And>x. x \<in> A \<Longrightarrow> x \<le> Sup B
[PROOF STEP]
assume "a \<in> A"
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (2 subgoals):
 1. countable A
 2. \<And>x. x \<in> A \<Longrightarrow> x \<le> Sup B
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
countable B
countable A
?a \<in> A \<Longrightarrow> \<exists>b\<in>B. ?a \<le> b
a \<in> A
[PROOF STEP]
obtain b where "b \<in> B" and "a \<le> b"
[PROOF STATE]
proof (prove)
using this:
countable B
countable A
?a \<in> A \<Longrightarrow> \<exists>b\<in>B. ?a \<le> b
a \<in> A

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>b \<in> B; a \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> B
a \<le> b

goal (2 subgoals):
 1. countable A
 2. \<And>x. x \<in> A \<Longrightarrow> x \<le> Sup B
[PROOF STEP]
from \<open>b \<in> B\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> B
[PROOF STEP]
have "b \<le> Sup B"
[PROOF STATE]
proof (prove)
using this:
b \<in> B

goal (1 subgoal):
 1. b \<le> Sup B
[PROOF STEP]
by (rule ccSup_upper[rotated]) auto
[PROOF STATE]
proof (state)
this:
b \<le> Sup B

goal (2 subgoals):
 1. countable A
 2. \<And>x. x \<in> A \<Longrightarrow> x \<le> Sup B
[PROOF STEP]
with \<open>a \<le> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
b \<le> Sup B
[PROOF STEP]
show "a \<le> Sup B"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
b \<le> Sup B

goal (1 subgoal):
 1. a \<le> Sup B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<le> Sup B

goal (1 subgoal):
 1. countable A
[PROOF STEP]
qed auto


[STATEMENT]
lemma foldSetD_backwards:
  assumes "A \<noteq> {}" "(A, z) \<in> foldSetD D f e"
  shows "\<exists>x y. x \<in> A \<and> (A - { x }, y) \<in> foldSetD D f e \<and> z = f x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. x \<in> A \<and> (A - {x}, y) \<in> foldSetD D f e \<and> z = f x y
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
(A, z) \<in> foldSetD D f e

goal (1 subgoal):
 1. \<exists>x y. x \<in> A \<and> (A - {x}, y) \<in> foldSetD D f e \<and> z = f x y
[PROOF STEP]
by (cases) (simp add: assms(1), metis Diff_insert_absorb insertI1)


[STATEMENT]
lemma incseq_def: "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<ge> X m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq X = (\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x \<le> y \<longrightarrow> X x \<le> X y) = (\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n)
[PROOF STEP]
..


[STATEMENT]
lemma hcomplex_hcnj_divide: "\<And>w z. hcnj (w / z) = hcnj w / hcnj z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w z. hcnj (w / z) = hcnj w / hcnj z
[PROOF STEP]
by transfer (rule complex_cnj_divide)


[STATEMENT]
lemma esqrt_tendsto [tendsto_intros]:
  assumes "((\<lambda>n. u n) \<longlongrightarrow> l) F"
  shows "((\<lambda>n. esqrt(u n)) \<longlongrightarrow> esqrt l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. esqrt (u n)) \<longlongrightarrow> esqrt l) F
[PROOF STEP]
using esqrt_continuous assms
[PROOF STATE]
proof (prove)
using this:
continuous_on UNIV esqrt
(u \<longlongrightarrow> l) F

goal (1 subgoal):
 1. ((\<lambda>n. esqrt (u n)) \<longlongrightarrow> esqrt l) F
[PROOF STEP]
by (metis UNIV_I continuous_on tendsto_compose)


[STATEMENT]
lemma prime_imp_coprime:
  assumes "prime p" "\<not>p dvd n"
  shows   "coprime p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime p n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
\<not> p dvd n

goal (1 subgoal):
 1. coprime p n
[PROOF STEP]
by (simp add: prime_elem_imp_coprime)


[STATEMENT]
lemma card_2_elements:
  assumes "card E = 2"
  shows "\<exists>a b. E = {a, b} \<and> a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
card E = 2
[PROOF STEP]
obtain a where "a \<in> E"
[PROOF STATE]
proof (prove)
using this:
card E = 2

goal (1 subgoal):
 1. (\<And>a. a \<in> E \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a \<in> E

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
let ?E' = "E - {a}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
have "finite ?E'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (E - {a})
[PROOF STEP]
using assms card_ge_0_finite
[PROOF STATE]
proof (prove)
using this:
card E = 2
0 < card ?A \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite (E - {a})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite (E - {a})

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
hence "card (insert a ?E') = 1 + card ?E'"
[PROOF STATE]
proof (prove)
using this:
finite (E - {a})

goal (1 subgoal):
 1. card (insert a (E - {a})) = 1 + card (E - {a})
[PROOF STEP]
using card.insert_remove
[PROOF STATE]
proof (prove)
using this:
finite (E - {a})
finite ?A \<Longrightarrow> card (insert ?x ?A) = Suc (card (?A - {?x}))

goal (1 subgoal):
 1. card (insert a (E - {a})) = 1 + card (E - {a})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (insert a (E - {a})) = 1 + card (E - {a})

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (insert a (E - {a})) = 1 + card (E - {a})

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
have "E = insert a ?E'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E = insert a (E - {a})
[PROOF STEP]
using \<open>a \<in> E\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> E

goal (1 subgoal):
 1. E = insert a (E - {a})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
E = insert a (E - {a})

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (insert a (E - {a})) = 1 + card (E - {a})
E = insert a (E - {a})
[PROOF STEP]
have "card E = 1 + card ?E'"
[PROOF STATE]
proof (prove)
using this:
card (insert a (E - {a})) = 1 + card (E - {a})
E = insert a (E - {a})

goal (1 subgoal):
 1. card E = 1 + card (E - {a})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card E = 1 + card (E - {a})

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
hence "card ?E' = 1"
[PROOF STATE]
proof (prove)
using this:
card E = 1 + card (E - {a})

goal (1 subgoal):
 1. card (E - {a}) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card E = 1 + card (E - {a})
card E = 2

goal (1 subgoal):
 1. card (E - {a}) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (E - {a}) = 1

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (E - {a}) = 1
[PROOF STEP]
obtain b where "?E' = {b}"
[PROOF STATE]
proof (prove)
using this:
card (E - {a}) = 1

goal (1 subgoal):
 1. (\<And>b. E - {a} = {b} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using card_1_element
[PROOF STATE]
proof (prove)
using this:
card (E - {a}) = 1
card ?E = 1 \<Longrightarrow> \<exists>a. ?E = {a}

goal (1 subgoal):
 1. (\<And>b. E - {a} = {b} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
E - {a} = {b}

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
hence "E = {a, b}"
[PROOF STATE]
proof (prove)
using this:
E - {a} = {b}

goal (1 subgoal):
 1. E = {a, b}
[PROOF STEP]
using \<open>a \<in> E\<close>
[PROOF STATE]
proof (prove)
using this:
E - {a} = {b}
a \<in> E

goal (1 subgoal):
 1. E = {a, b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
E = {a, b}

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
E = {a, b}

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
have "a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> b
[PROOF STEP]
using \<open>?E' = {b}\<close>
[PROOF STATE]
proof (prove)
using this:
E - {a} = {b}

goal (1 subgoal):
 1. a \<noteq> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
E = {a, b}
a \<noteq> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
E = {a, b}
a \<noteq> b

goal (1 subgoal):
 1. \<exists>a b. E = {a, b} \<and> a \<noteq> b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>a b. E = {a, b} \<and> a \<noteq> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_frac_add_preservation:
  fixes a d :: real
  assumes "0 < d" "d < 1 - frac a"
  shows "floor a = floor (a + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
have "frac a \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> frac a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> frac a

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
d < 1 - frac a
0 \<le> frac a
[PROOF STEP]
have "d < 1"
[PROOF STATE]
proof (prove)
using this:
d < 1 - frac a
0 \<le> frac a

goal (1 subgoal):
 1. d < 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
d < 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < d
d < 1 - frac a
[PROOF STEP]
have "a + d < a + 1 - frac a"
[PROOF STATE]
proof (prove)
using this:
0 < d
d < 1 - frac a

goal (1 subgoal):
 1. a + d < a + 1 - frac a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a + d < a + 1 - frac a

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a + d < a + 1 - frac a

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
have "\<dots> = (a - frac a) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + 1 - frac a = a - frac a + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a + 1 - frac a = a - frac a + 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a + 1 - frac a = a - frac a + 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
have "\<dots> = (floor a) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - frac a + 1 = real_of_int (\<lfloor>a\<rfloor> + 1)
[PROOF STEP]
unfolding frac_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - (a - real_of_int \<lfloor>a\<rfloor>) + 1 = real_of_int (\<lfloor>a\<rfloor> + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a - frac a + 1 = real_of_int (\<lfloor>a\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a + d < real_of_int (\<lfloor>a\<rfloor> + 1)
[PROOF STEP]
have *: "a + d < floor a + 1"
[PROOF STATE]
proof (prove)
using this:
a + d < real_of_int (\<lfloor>a\<rfloor> + 1)

goal (1 subgoal):
 1. a + d < real_of_int (\<lfloor>a\<rfloor> + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a + d < real_of_int (\<lfloor>a\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
have "floor (a + d) \<ge> floor a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>
[PROOF STEP]
using \<open>d > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < d

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
a + d < real_of_int (\<lfloor>a\<rfloor> + 1)
[PROOF STEP]
have "floor (a + d) < floor a + 1"
[PROOF STATE]
proof (prove)
using this:
a + d < real_of_int (\<lfloor>a\<rfloor> + 1)

goal (1 subgoal):
 1. \<lfloor>a + d\<rfloor> < \<lfloor>a\<rfloor> + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lfloor>a + d\<rfloor> < \<lfloor>a\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>
\<lfloor>a + d\<rfloor> < \<lfloor>a\<rfloor> + 1
[PROOF STEP]
show "floor a = floor (a + d)"
[PROOF STATE]
proof (prove)
using this:
\<lfloor>a\<rfloor> \<le> \<lfloor>a + d\<rfloor>
\<lfloor>a + d\<rfloor> < \<lfloor>a\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lfloor>a\<rfloor> = \<lfloor>a + d\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "rec_list nil cons (x#xs) = cons x xs (rec_list nil cons xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_list nil cons (x # xs) = cons x xs (rec_list nil cons xs)
[PROOF STEP]
refute [maxsize = 2, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_list nil cons (x # xs) = cons x xs (rec_list nil cons xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma Max_wrt_altdef: "Max_wrt R = {x. R x x \<and> (\<forall>y. R x y \<longrightarrow> R y x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_wrt R = {x. R x x \<and> (\<forall>y. R x y \<longrightarrow> R y x)}
[PROOF STEP]
unfolding Max_wrt_def Max_wrt_among_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> UNIV. R x x \<and> (\<forall>y\<in>UNIV. R x y \<longrightarrow> R y x)} = {x. R x x \<and> (\<forall>y. R x y \<longrightarrow> R y x)}
[PROOF STEP]
by simp


[STATEMENT]
lemma ereal_sgn_abs:
  fixes l::ereal
  shows "sgn(l) * l = abs(l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn l * l = \<bar>l\<bar>
[PROOF STEP]
apply (cases l)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>r. l = ereal r \<Longrightarrow> sgn l * l = \<bar>l\<bar>
 2. l = \<infinity> \<Longrightarrow> sgn l * l = \<bar>l\<bar>
 3. l = - \<infinity> \<Longrightarrow> sgn l * l = \<bar>l\<bar>
[PROOF STEP]
by (auto simp add: sgn_if ereal_less_uminus_reorder)


[STATEMENT]
lemma nonneg_mat_power: assumes "A \<in> carrier_mat n n" "nonneg_mat A"
  shows "nonneg_mat (A ^\<^sub>m k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nonneg_mat (A ^\<^sub>m k)
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nonneg_mat (A ^\<^sub>m 0)
 2. \<And>k. nonneg_mat (A ^\<^sub>m k) \<Longrightarrow> nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. nonneg_mat (A ^\<^sub>m 0)
 2. \<And>k. nonneg_mat (A ^\<^sub>m k) \<Longrightarrow> nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nonneg_mat (A ^\<^sub>m 0)
[PROOF STEP]
by (auto simp: nonneg_mat_def)
[PROOF STATE]
proof (state)
this:
nonneg_mat (A ^\<^sub>m 0)

goal (1 subgoal):
 1. \<And>k. nonneg_mat (A ^\<^sub>m k) \<Longrightarrow> nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. nonneg_mat (A ^\<^sub>m k) \<Longrightarrow> nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
nonneg_mat (A ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>k. nonneg_mat (A ^\<^sub>m k) \<Longrightarrow> nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
from nonneg_mat_mult[OF this assms(2) _ assms(1), of n] assms(1)
[PROOF STATE]
proof (chain)
picking this:
A ^\<^sub>m k \<in> carrier_mat n n \<Longrightarrow> nonneg_mat (A ^\<^sub>m k * A)
A \<in> carrier_mat n n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
A ^\<^sub>m k \<in> carrier_mat n n \<Longrightarrow> nonneg_mat (A ^\<^sub>m k * A)
A \<in> carrier_mat n n

goal (1 subgoal):
 1. nonneg_mat (A ^\<^sub>m Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nonneg_mat (A ^\<^sub>m Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DERIV_neg_imp_decreasing_open:
  fixes a b :: real
    and f :: "real \<Rightarrow> real"
  assumes "a < b"
    and "\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> \<exists>y. DERIV f x :> y \<and> y < 0"
    and con: "continuous_on {a..b} f"
  shows "f a > f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
have "(\<lambda>x. -f x) a < (\<lambda>x. -f x) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - f a < - f b
[PROOF STEP]
proof (rule DERIV_pos_imp_increasing_open [of a b])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a < b
 2. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>a. - f a) has_real_derivative y) (at x) \<and> 0 < y
 3. continuous_on {a..b} (\<lambda>a. - f a)
[PROOF STEP]
show "\<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
\<lbrakk>a < ?x; ?x < b\<rbrakk> \<Longrightarrow> \<exists>y. (f has_real_derivative y) (at ?x) \<and> y < 0
continuous_on {a..b} f

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at x) \<and> 0 < y
[PROOF STEP]
by simp (metis field_differentiable_minus neg_0_less_iff_less)
[PROOF STATE]
proof (state)
this:
\<lbrakk>a < ?x; ?x < b\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. - f x) has_real_derivative y) (at ?x) \<and> 0 < y

goal (2 subgoals):
 1. a < b
 2. continuous_on {a..b} (\<lambda>a. - f a)
[PROOF STEP]
show "continuous_on {a..b} (\<lambda>x. - f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. - f x)
[PROOF STEP]
using con continuous_on_minus
[PROOF STATE]
proof (prove)
using this:
continuous_on {a..b} f
continuous_on ?s ?f \<Longrightarrow> continuous_on ?s (\<lambda>x. - ?f x)

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. - f x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. - f x)

goal (1 subgoal):
 1. a < b
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
- f a < - f b

goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- f a < - f b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- f a < - f b

goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f b < f a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subgraph_union[intro]:
  assumes "subgraph H1 G" "compatible H1 G"
  assumes "subgraph H2 G" "compatible H2 G"
  shows "subgraph (union H1 H2) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgraph (Digraph_Component.union H1 H2) G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subgraph (Digraph_Component.union H1 H2) G
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
subgraph H1 G
compatible H1 G
subgraph H2 G
compatible H2 G
[PROOF STEP]
have "wf_digraph (union H1 H2)"
[PROOF STATE]
proof (prove)
using this:
subgraph H1 G
compatible H1 G
subgraph H2 G
compatible H2 G

goal (1 subgoal):
 1. wf_digraph (Digraph_Component.union H1 H2)
[PROOF STEP]
by (auto intro: wellformed_union simp: compatible_def)
[PROOF STATE]
proof (state)
this:
wf_digraph (Digraph_Component.union H1 H2)

goal (1 subgoal):
 1. subgraph (Digraph_Component.union H1 H2) G
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
subgraph H1 G
compatible H1 G
subgraph H2 G
compatible H2 G
wf_digraph (Digraph_Component.union H1 H2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subgraph H1 G
compatible H1 G
subgraph H2 G
compatible H2 G
wf_digraph (Digraph_Component.union H1 H2)

goal (1 subgoal):
 1. subgraph (Digraph_Component.union H1 H2) G
[PROOF STEP]
by (auto simp add: subgraph_def union_def arc_to_ends_def compatible_def)
[PROOF STATE]
proof (state)
this:
subgraph (Digraph_Component.union H1 H2) G

goal:
No subgoals!
[PROOF STEP]
qed