[STATEMENT]
lemma isomorphic_density:
  assumes "G\<^sub>1 \<simeq> G\<^sub>2"
  shows "density G\<^sub>1 = density G\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ugraph_Lemmas.density G\<^sub>1 = Ugraph_Lemmas.density G\<^sub>2
[PROOF STEP]
unfolding density_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G\<^sub>1)) / real (card (uverts G\<^sub>1)) = real (card (uedges G\<^sub>2)) / real (card (uverts G\<^sub>2))
[PROOF STEP]
using isomorphic_cards[OF assms]
[PROOF STATE]
proof (prove)
using this:
card (uverts G\<^sub>1) = card (uverts G\<^sub>2)
card (uedges G\<^sub>1) = card (uedges G\<^sub>2)

goal (1 subgoal):
 1. real (card (uedges G\<^sub>1)) / real (card (uverts G\<^sub>1)) = real (card (uedges G\<^sub>2)) / real (card (uverts G\<^sub>2))
[PROOF STEP]
by simp


[STATEMENT]
lemma combine_prepend_replicate:
  "\<lbrakk> set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R \<rbrakk> \<Longrightarrow>
     combine ((replicate n \<zero>) @ Ks) Us = combine Ks (drop n Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate n \<zero> @ Ks) Us = combine Ks (drop n Us)
[PROOF STEP]
proof (induct n arbitrary: Us, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n Us. \<lbrakk>\<And>Us. \<lbrakk>set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate n \<zero> @ Ks) Us = combine Ks (drop n Us); set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate (Suc n) \<zero> @ Ks) Us = combine Ks (drop (Suc n) Us)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate n \<zero> @ Ks) ?Us = combine Ks (drop n ?Us)
set Ks \<subseteq> carrier R
set Us \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>n Us. \<lbrakk>\<And>Us. \<lbrakk>set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate n \<zero> @ Ks) Us = combine Ks (drop n Us); set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate (Suc n) \<zero> @ Ks) Us = combine Ks (drop (Suc n) Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (replicate n \<zero> @ Ks) ?Us = combine Ks (drop n ?Us)
set Ks \<subseteq> carrier R
set Us \<subseteq> carrier R

goal (1 subgoal):
 1. combine (replicate (Suc n) \<zero> @ Ks) Us = combine Ks (drop (Suc n) Us)
[PROOF STEP]
by (cases Us) (auto, meson combine_in_carrier ring_simprules(8) set_drop_subset subset_trans)
[PROOF STATE]
proof (state)
this:
combine (replicate (Suc n) \<zero> @ Ks) Us = combine Ks (drop (Suc n) Us)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bst_wrt_le_iff_sorted: "bst_wrt (\<le>) t \<longleftrightarrow> sorted (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst_wrt (\<le>) t = sorted (inorder t)
[PROOF STEP]
apply (induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bst_wrt (\<le>) \<langle>\<rangle> = sorted (inorder \<langle>\<rangle>)
 2. \<And>t1 x2 t2. \<lbrakk>bst_wrt (\<le>) t1 = sorted (inorder t1); bst_wrt (\<le>) t2 = sorted (inorder t2)\<rbrakk> \<Longrightarrow> bst_wrt (\<le>) \<langle>t1, x2, t2\<rangle> = sorted (inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>bst_wrt (\<le>) t1 = sorted (inorder t1); bst_wrt (\<le>) t2 = sorted (inorder t2)\<rbrakk> \<Longrightarrow> bst_wrt (\<le>) \<langle>t1, x2, t2\<rangle> = sorted (inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
by (fastforce simp: sorted_append intro: less_imp_le less_trans)


[STATEMENT]
lemma poly_roots_eq_imp_eq:
  fixes p q :: "complex poly"
  assumes "Polynomial.lead_coeff p = Polynomial.lead_coeff q"
  assumes "poly_roots p = poly_roots q"
  shows   "p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = q
[PROOF STEP]
proof (cases "p = 0 \<or> q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (p = 0 \<or> q = 0)

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
hence [simp]: "p \<noteq> 0" "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (p = 0 \<or> q = 0)

goal (1 subgoal):
 1. p \<noteq> 0 &&& q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
have "p = Polynomial.smult (Polynomial.lead_coeff p)
               (prod_mset (image_mset (\<lambda>x. [:-x, 1:]) (poly_roots p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])
[PROOF STEP]
by (rule fundamental_theorem_algebra_factorized')
[PROOF STATE]
proof (state)
this:
p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:])

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
have "\<dots> = Polynomial.smult (Polynomial.lead_coeff q)
                   (prod_mset (image_mset (\<lambda>x. [:-x, 1:]) (poly_roots q)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:]) = Polynomial.smult (Polynomial.lead_coeff q) (\<Prod>x\<in>#poly_roots q. [:- x, 1:])
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:]) = Polynomial.smult (Polynomial.lead_coeff q) (\<Prod>x\<in>#poly_roots q. [:- x, 1:])

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff p) (\<Prod>x\<in>#poly_roots p. [:- x, 1:]) = Polynomial.smult (Polynomial.lead_coeff q) (\<Prod>x\<in>#poly_roots q. [:- x, 1:])

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> p = q
[PROOF STEP]
have "\<dots> = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (Polynomial.lead_coeff q) (\<Prod>x\<in>#poly_roots q. [:- x, 1:]) = q
[PROOF STEP]
by (rule fundamental_theorem_algebra_factorized' [symmetric])
[PROOF STATE]
proof (state)
this:
Polynomial.smult (Polynomial.lead_coeff q) (\<Prod>x\<in>#poly_roots q. [:- x, 1:]) = q

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

goal (1 subgoal):
 1. p = q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p = q

goal (1 subgoal):
 1. p = 0 \<or> q = 0 \<Longrightarrow> p = q
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma ereal_liminf_limsup_add:
  fixes u v::"nat \<Rightarrow> ereal"
  shows "liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
 2. \<not> ?P \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
assume "limsup v = \<infinity> \<or> liminf u = \<infinity>"
[PROOF STATE]
proof (state)
this:
limsup v = \<infinity> \<or> liminf u = \<infinity>

goal (2 subgoals):
 1. ?P \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
 2. \<not> ?P \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limsup v = \<infinity> \<or> liminf u = \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
limsup v = \<infinity> \<or> liminf u = \<infinity>

goal (1 subgoal):
 1. liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
assume "\<not>(limsup v = \<infinity> \<or> liminf u = \<infinity>)"
[PROOF STATE]
proof (state)
this:
\<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>)
[PROOF STEP]
have "limsup v < \<infinity>" "liminf u < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>)

goal (1 subgoal):
 1. limsup v < \<infinity> &&& liminf u < \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limsup v < \<infinity>
liminf u < \<infinity>

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
define w where "w = (\<lambda>n. u n + v n)"
[PROOF STATE]
proof (state)
this:
w = (\<lambda>n. u n + v n)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
obtain r where r: "strict_mono r" "(u o r) \<longlonglongrightarrow> liminf u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_mono r; (u \<circ> r) \<longlonglongrightarrow> liminf u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using liminf_subseq_lim
[PROOF STATE]
proof (prove)
using this:
\<exists>r. strict_mono r \<and> (?u \<circ> r) \<longlonglongrightarrow> liminf ?u

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>strict_mono r; (u \<circ> r) \<longlonglongrightarrow> liminf u\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono r
(u \<circ> r) \<longlonglongrightarrow> liminf u

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
obtain s where s: "strict_mono s" "(w o r o s) \<longlonglongrightarrow> liminf (w o r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. \<lbrakk>strict_mono s; (w \<circ> r \<circ> s) \<longlonglongrightarrow> liminf (w \<circ> r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using liminf_subseq_lim
[PROOF STATE]
proof (prove)
using this:
\<exists>r. strict_mono r \<and> (?u \<circ> r) \<longlonglongrightarrow> liminf ?u

goal (1 subgoal):
 1. (\<And>s. \<lbrakk>strict_mono s; (w \<circ> r \<circ> s) \<longlonglongrightarrow> liminf (w \<circ> r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono s
(w \<circ> r \<circ> s) \<longlonglongrightarrow> liminf (w \<circ> r)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
obtain t where t: "strict_mono t" "(v o r o s o t) \<longlonglongrightarrow> limsup (v o r o s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t. \<lbrakk>strict_mono t; (v \<circ> r \<circ> s \<circ> t) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using limsup_subseq_lim
[PROOF STATE]
proof (prove)
using this:
\<exists>r. strict_mono r \<and> (?u \<circ> r) \<longlonglongrightarrow> limsup ?u

goal (1 subgoal):
 1. (\<And>t. \<lbrakk>strict_mono t; (v \<circ> r \<circ> s \<circ> t) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono t
(v \<circ> r \<circ> s \<circ> t) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
define a where "a = r o s o t"
[PROOF STATE]
proof (state)
this:
a = r \<circ> s \<circ> t

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have "strict_mono a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono a
[PROOF STEP]
using r s t
[PROOF STATE]
proof (prove)
using this:
strict_mono r
(u \<circ> r) \<longlonglongrightarrow> liminf u
strict_mono s
(w \<circ> r \<circ> s) \<longlonglongrightarrow> liminf (w \<circ> r)
strict_mono t
(v \<circ> r \<circ> s \<circ> t) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. strict_mono a
[PROOF STEP]
by (simp add: a_def strict_mono_o)
[PROOF STATE]
proof (state)
this:
strict_mono a

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have l:"(u o a) \<longlonglongrightarrow> liminf u"
         "(w o a) \<longlonglongrightarrow> liminf (w o r)"
         "(v o a) \<longlonglongrightarrow> limsup (v o r o s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<circ> a) \<longlonglongrightarrow> liminf u &&& (w \<circ> a) \<longlonglongrightarrow> liminf (w \<circ> r) &&& (v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)
[PROOF STEP]
apply (metis (no_types, lifting) r(2) s(1) t(1) LIMSEQ_subseq_LIMSEQ a_def comp_assoc)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (w \<circ> a) \<longlonglongrightarrow> liminf (w \<circ> r)
 2. (v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)
[PROOF STEP]
apply (metis (no_types, lifting) s(2) t(1) LIMSEQ_subseq_LIMSEQ a_def comp_assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)
[PROOF STEP]
apply (metis (no_types, lifting) t(2) a_def comp_assoc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(u \<circ> a) \<longlonglongrightarrow> liminf u
(w \<circ> a) \<longlonglongrightarrow> liminf (w \<circ> r)
(v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have "liminf (w o r) \<ge> liminf w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf w \<le> liminf (w \<circ> r)
[PROOF STEP]
by (simp add: liminf_subseq_mono r(1))
[PROOF STATE]
proof (state)
this:
liminf w \<le> liminf (w \<circ> r)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have "limsup (v o r o s) \<le> limsup v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (v \<circ> r \<circ> s) \<le> limsup v
[PROOF STEP]
by (simp add: comp_assoc limsup_subseq_mono r(1) s(1) strict_mono_o)
[PROOF STATE]
proof (state)
this:
limsup (v \<circ> r \<circ> s) \<le> limsup v

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limsup (v \<circ> r \<circ> s) \<le> limsup v
[PROOF STEP]
have b: "limsup (v o r o s) < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
limsup (v \<circ> r \<circ> s) \<le> limsup v

goal (1 subgoal):
 1. limsup (v \<circ> r \<circ> s) < \<infinity>
[PROOF STEP]
using \<open>limsup v < \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
limsup (v \<circ> r \<circ> s) \<le> limsup v
limsup v < \<infinity>

goal (1 subgoal):
 1. limsup (v \<circ> r \<circ> s) < \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limsup (v \<circ> r \<circ> s) < \<infinity>

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have "(\<lambda>n. (u o a) n + (v o a) n) \<longlonglongrightarrow> liminf u + limsup (v o r o s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
apply (rule tendsto_add_ereal_general)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<not> (liminf u = \<infinity> \<and> limsup (v \<circ> r \<circ> s) = - \<infinity> \<or> liminf u = - \<infinity> \<and> limsup (v \<circ> r \<circ> s) = \<infinity>)
 2. (u \<circ> a) \<longlonglongrightarrow> liminf u
 3. (v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)
[PROOF STEP]
using b \<open>liminf u < \<infinity>\<close> l(1) l(3)
[PROOF STATE]
proof (prove)
using this:
limsup (v \<circ> r \<circ> s) < \<infinity>
liminf u < \<infinity>
(u \<circ> a) \<longlonglongrightarrow> liminf u
(v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)

goal (3 subgoals):
 1. \<not> (liminf u = \<infinity> \<and> limsup (v \<circ> r \<circ> s) = - \<infinity> \<or> liminf u = - \<infinity> \<and> limsup (v \<circ> r \<circ> s) = \<infinity>)
 2. (u \<circ> a) \<longlonglongrightarrow> liminf u
 3. (v \<circ> a) \<longlonglongrightarrow> limsup (v \<circ> r \<circ> s)
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
have "(\<lambda>n. (u o a) n + (v o a) n) = (w o a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) = w \<circ> a
[PROOF STEP]
unfolding w_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) = (\<lambda>n. u n + v n) \<circ> a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) = w \<circ> a

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) = w \<circ> a
[PROOF STEP]
have "(w o a) \<longlonglongrightarrow> liminf u + limsup (v o r o s)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
(\<lambda>n. (u \<circ> a) n + (v \<circ> a) n) = w \<circ> a

goal (1 subgoal):
 1. (w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
have "liminf (w o r) = liminf u + limsup (v o r o s)"
[PROOF STATE]
proof (prove)
using this:
(w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
using l(2)
[PROOF STATE]
proof (prove)
using this:
(w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
(w \<circ> a) \<longlonglongrightarrow> liminf (w \<circ> r)

goal (1 subgoal):
 1. liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
using LIMSEQ_unique
[PROOF STATE]
proof (prove)
using this:
(w \<circ> a) \<longlonglongrightarrow> liminf u + limsup (v \<circ> r \<circ> s)
(w \<circ> a) \<longlonglongrightarrow> liminf (w \<circ> r)
\<lbrakk>?X \<longlonglongrightarrow> ?a; ?X \<longlonglongrightarrow> ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)
[PROOF STEP]
have "liminf w \<le> liminf u + limsup v"
[PROOF STATE]
proof (prove)
using this:
liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)

goal (1 subgoal):
 1. liminf w \<le> liminf u + limsup v
[PROOF STEP]
using \<open>liminf (w o r) \<ge> liminf w\<close> \<open>limsup (v o r o s) \<le> limsup v\<close>
[PROOF STATE]
proof (prove)
using this:
liminf (w \<circ> r) = liminf u + limsup (v \<circ> r \<circ> s)
liminf w \<le> liminf (w \<circ> r)
limsup (v \<circ> r \<circ> s) \<le> limsup v

goal (1 subgoal):
 1. liminf w \<le> liminf u + limsup v
[PROOF STEP]
by (metis add_mono_thms_linordered_semiring(2) le_less_trans not_less)
[PROOF STATE]
proof (state)
this:
liminf w \<le> liminf u + limsup v

goal (1 subgoal):
 1. \<not> (limsup v = \<infinity> \<or> liminf u = \<infinity>) \<Longrightarrow> liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
liminf w \<le> liminf u + limsup v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
liminf w \<le> liminf u + limsup v

goal (1 subgoal):
 1. liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
unfolding w_def
[PROOF STATE]
proof (prove)
using this:
liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v

goal (1 subgoal):
 1. liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>n. u n + v n) \<le> liminf u + limsup v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_coeff_Sum_any:
  assumes "finite {x. f x \<noteq> 0}"
  shows   "poly.coeff (Sum_any f) n = Sum_any (\<lambda>x. poly.coeff (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
have "Sum_any f = (\<Sum>x | f x \<noteq> 0. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sum_any f = (\<Sum>x | f x \<noteq> 0. f x)
[PROOF STEP]
by (rule Sum_any.expand_set)
[PROOF STATE]
proof (state)
this:
Sum_any f = (\<Sum>x | f x \<noteq> 0. f x)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sum_any f = (\<Sum>x | f x \<noteq> 0. f x)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
have "poly.coeff \<dots> n = (\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (\<Sum>x | f x \<noteq> 0. f x) n = (\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n)
[PROOF STEP]
by (simp add: Polynomial.coeff_sum)
[PROOF STATE]
proof (state)
this:
poly.coeff (\<Sum>x | f x \<noteq> 0. f x) n = (\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly.coeff (\<Sum>x | f x \<noteq> 0. f x) n = (\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
have "\<dots> = Sum_any (\<lambda>x. poly.coeff (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n) = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
by (rule Sum_any.expand_superset [symmetric]) (use assms in auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>x | f x \<noteq> 0. poly.coeff (f x) n) = (\<Sum>x. poly.coeff (f x) n)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)

goal (1 subgoal):
 1. poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly.coeff (Sum_any f) n = (\<Sum>x. poly.coeff (f x) n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_cbox_convex:
  fixes x :: "'a::euclidean_space"
  assumes x: "x \<in> box a b"
    and y: "y \<in> cbox a b"
    and e: "0 < e" "e \<le> 1"
  shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> box a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
fix i :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
assume i: "i \<in> Basis"
[PROOF STATE]
proof (state)
this:
i \<in> Basis

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
have "a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)
[PROOF STEP]
unfolding left_diff_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<bullet> i = e * (a \<bullet> i) + (1 * (a \<bullet> i) - e * (a \<bullet> i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
have "\<dots> < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (a \<bullet> i) + (1 - e) * (a \<bullet> i) < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)
[PROOF STEP]
proof (rule add_less_le_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. e * (a \<bullet> i) < e * (x \<bullet> i)
 2. (1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)
[PROOF STEP]
show "e * (a \<bullet> i) < e * (x \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (a \<bullet> i) < e * (x \<bullet> i)
[PROOF STEP]
using \<open>0 < e\<close> i mem_box(1) x
[PROOF STATE]
proof (prove)
using this:
0 < e
i \<in> Basis
(?x \<in> box ?a ?b) = (\<forall>i\<in>Basis. ?a \<bullet> i < ?x \<bullet> i \<and> ?x \<bullet> i < ?b \<bullet> i)
x \<in> box a b

goal (1 subgoal):
 1. e * (a \<bullet> i) < e * (x \<bullet> i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * (a \<bullet> i) < e * (x \<bullet> i)

goal (1 subgoal):
 1. (1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)
[PROOF STEP]
show "(1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)
[PROOF STEP]
by (meson diff_ge_0_iff_ge \<open>e \<le> 1\<close> i mem_box(2) mult_left_mono y)
[PROOF STATE]
proof (state)
this:
(1 - e) * (a \<bullet> i) \<le> (1 - e) * (y \<bullet> i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
e * (a \<bullet> i) + (1 - e) * (a \<bullet> i) < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a \<bullet> i < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)
[PROOF STEP]
have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
a \<bullet> i < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)

goal (1 subgoal):
 1. a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i
[PROOF STEP]
unfolding inner_simps
[PROOF STATE]
proof (prove)
using this:
a \<bullet> i < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)

goal (1 subgoal):
 1. a \<bullet> i < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
have "b \<bullet> i = e * (b\<bullet>i) + (1 - e) * (b\<bullet>i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> i = e * (b \<bullet> i) + (1 - e) * (b \<bullet> i)
[PROOF STEP]
unfolding left_diff_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> i = e * (b \<bullet> i) + (1 * (b \<bullet> i) - e * (b \<bullet> i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b \<bullet> i = e * (b \<bullet> i) + (1 - e) * (b \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b \<bullet> i = e * (b \<bullet> i) + (1 - e) * (b \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
have "\<dots> > e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < e * (b \<bullet> i) + (1 - e) * (b \<bullet> i)
[PROOF STEP]
proof (rule add_less_le_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. e * (x \<bullet> i) < e * (b \<bullet> i)
 2. (1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)
[PROOF STEP]
show "e * (x \<bullet> i) < e * (b \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (x \<bullet> i) < e * (b \<bullet> i)
[PROOF STEP]
using \<open>0 < e\<close> i mem_box(1) x
[PROOF STATE]
proof (prove)
using this:
0 < e
i \<in> Basis
(?x \<in> box ?a ?b) = (\<forall>i\<in>Basis. ?a \<bullet> i < ?x \<bullet> i \<and> ?x \<bullet> i < ?b \<bullet> i)
x \<in> box a b

goal (1 subgoal):
 1. e * (x \<bullet> i) < e * (b \<bullet> i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * (x \<bullet> i) < e * (b \<bullet> i)

goal (1 subgoal):
 1. (1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)
[PROOF STEP]
show "(1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)
[PROOF STEP]
by (meson diff_ge_0_iff_ge \<open>e \<le> 1\<close> i mem_box(2) mult_left_mono y)
[PROOF STATE]
proof (state)
this:
(1 - e) * (y \<bullet> i) \<le> (1 - e) * (b \<bullet> i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < e * (b \<bullet> i) + (1 - e) * (b \<bullet> i)

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < b \<bullet> i
[PROOF STEP]
have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < b \<bullet> i

goal (1 subgoal):
 1. (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i
[PROOF STEP]
unfolding inner_simps
[PROOF STATE]
proof (prove)
using this:
e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < b \<bullet> i

goal (1 subgoal):
 1. e * (x \<bullet> i) + (1 - e) * (y \<bullet> i) < b \<bullet> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i
(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i
[PROOF STEP]
have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i"
[PROOF STATE]
proof (prove)
using this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i
(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i

goal (1 subgoal):
 1. a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 \<in> Basis \<Longrightarrow> a \<bullet> ?i2 < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 < b \<bullet> ?i2

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i2 \<in> Basis \<Longrightarrow> a \<bullet> ?i2 < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 < b \<bullet> ?i2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i2 \<in> Basis \<Longrightarrow> a \<bullet> ?i2 < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 < b \<bullet> ?i2

goal (1 subgoal):
 1. e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b
[PROOF STEP]
unfolding mem_box
[PROOF STATE]
proof (prove)
using this:
?i2 \<in> Basis \<Longrightarrow> a \<bullet> ?i2 < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> ?i2 < b \<bullet> ?i2

goal (1 subgoal):
 1. \<forall>i\<in>Basis. a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e *\<^sub>R x + (1 - e) *\<^sub>R y \<in> box a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_on_reindex_bij_betw:
  assumes "bij_betw g A B"
  shows   "(\<lambda>x. f (g x)) summable_on A \<longleftrightarrow> f summable_on B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
thm summable_on_reindex
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
have \<open>(\<lambda>x. f (g x)) summable_on A \<longleftrightarrow> f summable_on g ` A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on g ` A)
[PROOF STEP]
apply (rule summable_on_reindex[symmetric, unfolded o_def])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on g A
[PROOF STEP]
using assms bij_betw_imp_inj_on
[PROOF STATE]
proof (prove)
using this:
bij_betw g A B
bij_betw ?f ?A ?B \<Longrightarrow> inj_on ?f ?A

goal (1 subgoal):
 1. inj_on g A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (g x)) summable_on A) = (f summable_on g ` A)

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (g x)) summable_on A) = (f summable_on g ` A)

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
have \<open>\<dots> \<longleftrightarrow> f summable_on B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f summable_on g ` A) = (f summable_on B)
[PROOF STEP]
using assms bij_betw_imp_surj_on
[PROOF STATE]
proof (prove)
using this:
bij_betw g A B
bij_betw ?f ?A ?B \<Longrightarrow> ?f ` ?A = ?B

goal (1 subgoal):
 1. (f summable_on g ` A) = (f summable_on B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(f summable_on g ` A) = (f summable_on B)

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)

goal (1 subgoal):
 1. ((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (g x)) summable_on A) = (f summable_on B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sym_group_inv_equality [simp]:
  assumes "p \<in> carrier (sym_group n)" shows "inv\<^bsub>(sym_group n)\<^esub> p = inv' p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
have "inv' p \<circ> p = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv' p \<circ> p = id
[PROOF STEP]
using assms permutes_inv_o(2) sym_group_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (sym_group n)
?p permutes ?S \<Longrightarrow> inv' ?p \<circ> ?p = id
sym_group ?n = \<lparr>carrier = {p. p permutes {1..?n}}, monoid.mult = (\<circ>), one = id\<rparr>

goal (1 subgoal):
 1. inv' p \<circ> p = id
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv' p \<circ> p = id

goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
hence "(inv' p) \<otimes>\<^bsub>(sym_group n)\<^esub> p = one (sym_group n)"
[PROOF STATE]
proof (prove)
using this:
inv' p \<circ> p = id

goal (1 subgoal):
 1. inv' p \<otimes>\<^bsub>sym_group n\<^esub> p = \<one>\<^bsub>sym_group n\<^esub>
[PROOF STEP]
by (simp add: sym_group_def)
[PROOF STATE]
proof (state)
this:
inv' p \<otimes>\<^bsub>sym_group n\<^esub> p = \<one>\<^bsub>sym_group n\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inv' p \<otimes>\<^bsub>sym_group n\<^esub> p = \<one>\<^bsub>sym_group n\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
using group.inv_equality[OF sym_group_is_group]
[PROOF STATE]
proof (prove)
using this:
inv' p \<otimes>\<^bsub>sym_group n\<^esub> p = \<one>\<^bsub>sym_group n\<^esub>
\<lbrakk>?y \<otimes>\<^bsub>sym_group ?n1\<^esub> ?x = \<one>\<^bsub>sym_group ?n1\<^esub>; ?x \<in> carrier (sym_group ?n1); ?y \<in> carrier (sym_group ?n1)\<rbrakk> \<Longrightarrow> inv\<^bsub>sym_group ?n1\<^esub> ?x = ?y

goal (1 subgoal):
 1. inv\<^bsub>sym_group n\<^esub> p = inv' p
[PROOF STEP]
by (simp add: assms sym_group_inv_closed)
[PROOF STATE]
proof (state)
this:
inv\<^bsub>sym_group n\<^esub> p = inv' p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_lfp_tail_rec_def :
assumes mono_f: "mono f"
shows "set_lfp s f = (if (f s) \<subseteq> s then s else (set_lfp (s \<union> f s) f))" (is "?ls = ?rs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
proof (cases "f s \<subseteq> s")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
 2. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f s \<subseteq> s

goal (2 subgoals):
 1. f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
 2. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
note fs_sub_s = this
[PROOF STATE]
proof (state)
this:
f s \<subseteq> s

goal (2 subgoals):
 1. f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
 2. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
from fs_sub_s
[PROOF STATE]
proof (chain)
picking this:
f s \<subseteq> s
[PROOF STEP]
have "\<Inter>{u. f u \<union> s \<subseteq> u} = s"
[PROOF STATE]
proof (prove)
using this:
f s \<subseteq> s

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} = s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Inter> {u. f u \<union> s \<subseteq> u} = s

goal (2 subgoals):
 1. f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
 2. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
hence "?ls = s"
[PROOF STATE]
proof (prove)
using this:
\<Inter> {u. f u \<union> s \<subseteq> u} = s

goal (1 subgoal):
 1. set_lfp s f = s
[PROOF STEP]
unfolding set_lfp_def lfp_def
[PROOF STATE]
proof (prove)
using this:
\<Inter> {u. f u \<union> s \<subseteq> u} = s

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} = s
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set_lfp s f = s

goal (2 subgoals):
 1. f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
 2. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
with fs_sub_s
[PROOF STATE]
proof (chain)
picking this:
f s \<subseteq> s
set_lfp s f = s
[PROOF STEP]
show "?ls = ?rs"
[PROOF STATE]
proof (prove)
using this:
f s \<subseteq> s
set_lfp s f = s

goal (1 subgoal):
 1. set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> f s \<subseteq> s

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
note not_fs_sub_s = this
[PROOF STATE]
proof (state)
this:
\<not> f s \<subseteq> s

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
from mono_f
[PROOF STATE]
proof (chain)
picking this:
mono f
[PROOF STEP]
have mono_f': "mono (\<lambda>s'. f s' \<union> s)"
[PROOF STATE]
proof (prove)
using this:
mono f

goal (1 subgoal):
 1. mono (\<lambda>s'. f s' \<union> s)
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<subseteq> y \<longrightarrow> f x \<subseteq> f y

goal (1 subgoal):
 1. \<forall>x y. x \<subseteq> y \<longrightarrow> f x \<union> s \<subseteq> f y \<union> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mono (\<lambda>s'. f s' \<union> s)

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
have "\<Inter>{u. f u \<union> s \<subseteq> u} = \<Inter>{u. f u \<union> (s \<union> f s) \<subseteq> u}" (is "\<Inter>?S1 = \<Inter>?S2")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} = \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}
 2. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
have "?S2 \<subseteq> ?S1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> {u. f u \<union> s \<subseteq> u}

goal (2 subgoals):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}
 2. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
thus "\<Inter>?S1 \<subseteq> \<Inter>?S2"
[PROOF STATE]
proof (prove)
using this:
{u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> {u. f u \<union> s \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}
[PROOF STEP]
by (rule Inf_superset_mono)
[PROOF STATE]
proof (state)
this:
\<Inter> {u. f u \<union> s \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
fix e
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
assume "e \<in> \<Inter>?S2"
[PROOF STATE]
proof (state)
this:
e \<in> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
hence S2_prop: "\<And>s'. f s' \<subseteq> s' \<Longrightarrow> s \<subseteq> s' \<Longrightarrow> f s \<subseteq> s' \<Longrightarrow> e \<in> s'"
[PROOF STATE]
proof (prove)
using this:
e \<in> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. \<And>s'. \<lbrakk>f s' \<subseteq> s'; s \<subseteq> s'; f s \<subseteq> s'\<rbrakk> \<Longrightarrow> e \<in> s'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>f ?s' \<subseteq> ?s'; s \<subseteq> ?s'; f s \<subseteq> ?s'\<rbrakk> \<Longrightarrow> e \<in> ?s'

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>f ?s' \<subseteq> ?s'; s \<subseteq> ?s'; f s \<subseteq> ?s'\<rbrakk> \<Longrightarrow> e \<in> ?s'

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
fix s'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
assume "f s' \<subseteq> s'" "s \<subseteq> s'"
[PROOF STATE]
proof (state)
this:
f s' \<subseteq> s'
s \<subseteq> s'

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
from mono_f \<open>s \<subseteq> s'\<close>
[PROOF STATE]
proof (chain)
picking this:
mono f
s \<subseteq> s'
[PROOF STEP]
have "f s \<subseteq> f s'"
[PROOF STATE]
proof (prove)
using this:
mono f
s \<subseteq> s'

goal (1 subgoal):
 1. f s \<subseteq> f s'
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x \<subseteq> y \<longrightarrow> f x \<subseteq> f y
s \<subseteq> s'

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

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
with \<open>f s' \<subseteq> s'\<close>
[PROOF STATE]
proof (chain)
picking this:
f s' \<subseteq> s'
f s \<subseteq> f s'
[PROOF STEP]
have "f s \<subseteq> s'"
[PROOF STATE]
proof (prove)
using this:
f s' \<subseteq> s'
f s \<subseteq> f s'

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

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
with \<open>f s' \<subseteq> s'\<close> \<open>s \<subseteq> s'\<close> S2_prop
[PROOF STATE]
proof (chain)
picking this:
f s' \<subseteq> s'
s \<subseteq> s'
\<lbrakk>f ?s' \<subseteq> ?s'; s \<subseteq> ?s'; f s \<subseteq> ?s'\<rbrakk> \<Longrightarrow> e \<in> ?s'
f s \<subseteq> s'
[PROOF STEP]
have "e \<in> s'"
[PROOF STATE]
proof (prove)
using this:
f s' \<subseteq> s'
s \<subseteq> s'
\<lbrakk>f ?s' \<subseteq> ?s'; s \<subseteq> ?s'; f s \<subseteq> ?s'\<rbrakk> \<Longrightarrow> e \<in> ?s'
f s \<subseteq> s'

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

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>f ?s'2 \<subseteq> ?s'2; s \<subseteq> ?s'2\<rbrakk> \<Longrightarrow> e \<in> ?s'2

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
hence "e \<in> \<Inter>?S1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f ?s'2 \<subseteq> ?s'2; s \<subseteq> ?s'2\<rbrakk> \<Longrightarrow> e \<in> ?s'2

goal (1 subgoal):
 1. e \<in> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e \<in> \<Inter> {u. f u \<union> s \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?e2 \<in> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<Longrightarrow> ?e2 \<in> \<Inter> {u. f u \<union> s \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
thus "\<Inter>?S2 \<subseteq> \<Inter>?S1"
[PROOF STATE]
proof (prove)
using this:
?e2 \<in> \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<Longrightarrow> ?e2 \<in> \<Inter> {u. f u \<union> s \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u} \<subseteq> \<Inter> {u. f u \<union> s \<subseteq> u}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Inter> {u. f u \<union> s \<subseteq> u} = \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
hence "?ls = (set_lfp (s \<union> f s) f)"
[PROOF STATE]
proof (prove)
using this:
\<Inter> {u. f u \<union> s \<subseteq> u} = \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. set_lfp s f = set_lfp (s \<union> f s) f
[PROOF STEP]
unfolding set_lfp_def lfp_def
[PROOF STATE]
proof (prove)
using this:
\<Inter> {u. f u \<union> s \<subseteq> u} = \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}

goal (1 subgoal):
 1. \<Inter> {u. f u \<union> s \<subseteq> u} = \<Inter> {u. f u \<union> (s \<union> f s) \<subseteq> u}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
set_lfp s f = set_lfp (s \<union> f s) f

goal (1 subgoal):
 1. \<not> f s \<subseteq> s \<Longrightarrow> set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
with not_fs_sub_s
[PROOF STATE]
proof (chain)
picking this:
\<not> f s \<subseteq> s
set_lfp s f = set_lfp (s \<union> f s) f
[PROOF STEP]
show "?ls = ?rs"
[PROOF STATE]
proof (prove)
using this:
\<not> f s \<subseteq> s
set_lfp s f = set_lfp (s \<union> f s) f

goal (1 subgoal):
 1. set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_lfp s f = (if f s \<subseteq> s then s else set_lfp (s \<union> f s) f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mk_poly2_row_col:
  assumes dim[simp]: "dim_vec pv = n" "dim_row A = n" and j: "j < dim_col A"
  shows "mk_poly2_row A d j pv n = pv + map_vec (\<lambda>a. monom a d) (col A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_poly2_row A d j pv n = pv + map_vec (\<lambda>a. monom a d) (col A j)
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (pv + map_vec (\<lambda>a. monom a d) (col A j)) \<Longrightarrow> mk_poly2_row A d j pv n $ i = (pv + map_vec (\<lambda>a. monom a d) (col A j)) $ i
 2. dim_vec (mk_poly2_row A d j pv n) = dim_vec (pv + map_vec (\<lambda>a. monom a d) (col A j))
[PROOF STEP]
using mk_poly2_row[of _ pv] j
[PROOF STATE]
proof (prove)
using this:
?n \<le> dim_vec pv \<Longrightarrow> mk_poly2_row ?A ?d ?j pv ?n $ ?i = (if ?i < ?n then pv $ ?i + monom (?A $$ (?i, ?j)) ?d else pv $ ?i)
j < dim_col A

goal (2 subgoals):
 1. \<And>i. i < dim_vec (pv + map_vec (\<lambda>a. monom a d) (col A j)) \<Longrightarrow> mk_poly2_row A d j pv n $ i = (pv + map_vec (\<lambda>a. monom a d) (col A j)) $ i
 2. dim_vec (mk_poly2_row A d j pv n) = dim_vec (pv + map_vec (\<lambda>a. monom a d) (col A j))
[PROOF STEP]
by auto


[STATEMENT]
lemma dist_triangle_less_add: "dist x1 y < e1 \<Longrightarrow> dist x2 y < e2 \<Longrightarrow> dist x1 x2 < e1 + e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dist x1 y < e1; dist x2 y < e2\<rbrakk> \<Longrightarrow> dist x1 x2 < e1 + e2
[PROOF STEP]
by (rule dist_triangle_lt [where z=y]) simp


[STATEMENT]
lemma nat_induct2:
  "\<lbrakk> P 0; P (Suc 0); \<And>k. P k ==> P (Suc k) ==> P (Suc (Suc k)) \<rbrakk>
  \<Longrightarrow> P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; P (Suc 0); \<And>k. \<lbrakk>P k; P (Suc k)\<rbrakk> \<Longrightarrow> P (Suc (Suc k))\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
by induction_schema (pat_completeness, lexicographic_order)


[STATEMENT]
lemma floor_log_eq_powr_iff: "x > 0 \<Longrightarrow> b > 1 \<Longrightarrow> \<lfloor>log b x\<rfloor> = k \<longleftrightarrow> b powr k \<le> x \<and> x < b powr (k + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 1 < b\<rbrakk> \<Longrightarrow> (\<lfloor>log b x\<rfloor> = k) = (b powr real_of_int k \<le> x \<and> x < b powr real_of_int (k + 1))
[PROOF STEP]
by (auto simp: floor_eq_iff powr_le_iff less_powr_iff)


[STATEMENT]
lemma enat_ex_split: "(\<exists>c::enat. P c) \<longleftrightarrow> P \<infinity> \<or> (\<exists>c::nat. P c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>c. P c) = (P \<infinity> \<or> (\<exists>x. P (enat x)))
[PROOF STEP]
by (metis enat.exhaust)


[STATEMENT]
lemma meet_assoc[simp]: "((x::'a::Finite_Meet_cpo) \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
apply (rule is_meetI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> x \<sqinter> y
 2. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> z
 3. \<And>a. \<lbrakk>a \<sqsubseteq> x \<sqinter> y; a \<sqsubseteq> z\<rbrakk> \<Longrightarrow> a \<sqsubseteq> x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
apply (metis below_refl meet_above_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<sqinter> (y \<sqinter> z) \<sqsubseteq> z
 2. \<And>a. \<lbrakk>a \<sqsubseteq> x \<sqinter> y; a \<sqsubseteq> z\<rbrakk> \<Longrightarrow> a \<sqsubseteq> x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
apply (metis below_refl meet_below2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>a \<sqsubseteq> x \<sqinter> y; a \<sqsubseteq> z\<rbrakk> \<Longrightarrow> a \<sqsubseteq> x \<sqinter> (y \<sqinter> z)
[PROOF STEP]
apply (metis meet_above_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma up3_def2[simp,code]:
  "up3 x sib twist u = (case u of
  Same2 \<Rightarrow> Same2 |
  Bal2 t \<Rightarrow> Bal2 (node twist t x sib) |
  Unbal2 t n1 h1 \<Rightarrow>
     let n2 = size_tree sib; t' = node twist t x sib; n' = n1 + n2 + 1; h' = h1 + 1
     in if bal_i n' h' then Unbal2 t' n' h'
        else let t'' = bal_tree n' t' in Bal2 t'')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. up3 x sib twist u = (case u of Same2 \<Rightarrow> Same2 | Bal2 t \<Rightarrow> Bal2 (node twist t x sib) | Unbal2 t n1 h1 \<Rightarrow> let n2 = Root_Balanced_Tree.size_tree sib; t' = node twist t x sib; n' = n1 + n2 + 1; h' = h1 + 1 in if bal_i n' h' then Unbal2 t' n' h' else Let (Root_Balanced_Tree.bal_tree n' t') Bal2)
[PROOF STEP]
using val_cong[OF up3_tm_def]
[PROOF STATE]
proof (prove)
using this:
Time_Monad.val (up3_tm ?x1 ?sib1 ?twist1 ?u1) = Time_Monad.val ((case ?u1 of Same2 \<Rightarrow> return Same2 | Bal2 t \<Rightarrow> return (Bal2 (node ?twist1 t ?x1 ?sib1)) | Unbal2 t n1 h1 \<Rightarrow> size_tree_tm ?sib1 \<bind> (\<lambda>n2. let t' = node ?twist1 t ?x1 ?sib1; n' = n1 + n2 + 1; h' = h1 + 1 in if bal_i n' h' then return (Unbal2 t' n' h') else bal_tree_tm n' t' \<bind> (\<lambda>t''. return (Bal2 t'')))) \<bind> tick)

goal (1 subgoal):
 1. up3 x sib twist u = (case u of Same2 \<Rightarrow> Same2 | Bal2 t \<Rightarrow> Bal2 (node twist t x sib) | Unbal2 t n1 h1 \<Rightarrow> let n2 = Root_Balanced_Tree.size_tree sib; t' = node twist t x sib; n' = n1 + n2 + 1; h' = h1 + 1 in if bal_i n' h' then Unbal2 t' n' h' else Let (Root_Balanced_Tree.bal_tree n' t') Bal2)
[PROOF STEP]
by(simp only: up3_def size_tree_def bal_tree_def val_simps up2.case_distrib[of val])


[STATEMENT]
lemma has_derivative_at_alt:
  "(f has_derivative f') (at x) \<longleftrightarrow>
    bounded_linear f' \<and>
    (\<forall>e>0. \<exists>d>0. \<forall>y. norm(y - x) < d \<longrightarrow> norm (f y - f x - f'(y - x)) \<le> e * norm (y - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x) = (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)))
[PROOF STEP]
using has_derivative_within_alt[where s=UNIV]
[PROOF STATE]
proof (prove)
using this:
(?f has_derivative ?f') (at ?x) = (bounded_linear ?f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>y\<in>UNIV. norm (y - ?x) < d \<longrightarrow> norm (?f y - ?f ?x - ?f' (y - ?x)) \<le> e * norm (y - ?x)))

goal (1 subgoal):
 1. (f has_derivative f') (at x) = (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)))
[PROOF STEP]
by simp


[STATEMENT]
lemma int_sym: "interval a b = interval b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval a b = interval b a
[PROOF STEP]
by (simp add: insert_commute interval_def seg_sym)


[STATEMENT]
lemma psi_ubound_log_double_cases:
  assumes "\<forall>n\<le>m. psi n \<le> c * ln 2 * real n"
          "c' \<ge> 1 + c/2 + (4 * ln (m+1) + 3) / (ln 2 * (m+1))"
          "m' = 2*m" "c \<le> c'" "c \<ge> 0" "m \<ge> 1"
  shows   "\<forall>n\<le>m'. psi n \<le> c' * ln 2 * real n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<le>m'. psi n \<le> c' * ln 2 * real n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<le>m. psi n \<le> c * ln 2 * real n

goal (1 subgoal):
 1. \<forall>n\<le>m'. psi n \<le> c' * ln 2 * real n
[PROOF STEP]
by (intro allI impI assms psi_ubound_log_double_cases'[of m c _ m' c']) auto


[STATEMENT]
lemma "((0::real) \<le> -x) = (x \<le> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> - x) = (x \<le> 0)
[PROOF STEP]
by arith


[STATEMENT]
lemma rcis_inverse: "inverse(rcis r a) = rcis (1 / r) (- a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (rcis r a) = rcis (1 / r) (- a)
[PROOF STEP]
by (simp add: divide_inverse rcis_def)


[STATEMENT]
lemma bind_spmf_spmf_of_set:
  "\<And>A. \<lbrakk> finite A; A \<noteq> {} \<rbrakk> \<Longrightarrow> bind_spmf (spmf_of_set A) = bind_pmf (pmf_of_set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> (\<bind>) (spmf_of_set A) = (\<bind>) (pmf_of_set A)
[PROOF STEP]
by(simp add: spmf_of_set_def fun_eq_iff del: spmf_of_pmf_pmf_of_set)


[STATEMENT]
lemma listsum_bound: "(\<And> x. x \<in> set xs \<Longrightarrow> f x \<ge> (0::real)) \<Longrightarrow>
        foldr (+) (map f xs) y \<ge> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f xs) y
[PROOF STEP]
apply(induction xs arbitrary: y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. (\<And>x. x \<in> set [] \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f []) y
 2. \<And>a xs y. \<lbrakk>\<And>y. (\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f xs) y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> 0 \<le> f x\<rbrakk> \<Longrightarrow> y \<le> foldr (+) (map f (a # xs)) y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs y. \<lbrakk>\<And>y. (\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f xs) y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> 0 \<le> f x\<rbrakk> \<Longrightarrow> y \<le> foldr (+) (map f (a # xs)) y
[PROOF STEP]
apply(subst list.map(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs y. \<lbrakk>\<And>y. (\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f xs) y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> 0 \<le> f x\<rbrakk> \<Longrightarrow> y \<le> foldr (+) (f a # map f xs) y
[PROOF STEP]
apply(subst foldr.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs y. \<lbrakk>\<And>y. (\<And>x. x \<in> set xs \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> y \<le> foldr (+) (map f xs) y; \<And>x. x \<in> set (a # xs) \<Longrightarrow> 0 \<le> f x\<rbrakk> \<Longrightarrow> y \<le> ((+) (f a) \<circ> foldr (+) (map f xs)) y
[PROOF STEP]
apply (simp add: add_increasing)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_remove_nth:
  assumes "distinct xs" "j < length xs"
  shows "set (remove_nth j xs) = set xs - {xs ! j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (remove_nth j xs) = set xs - {xs ! j}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs
j < length xs

goal (1 subgoal):
 1. set (remove_nth j xs) = set xs - {xs ! j}
[PROOF STEP]
proof (induct xs arbitrary: j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>distinct []; j < length []\<rbrakk> \<Longrightarrow> set (remove_nth j []) = set [] - {[] ! j}
 2. \<And>a xs j. \<lbrakk>\<And>j. \<lbrakk>distinct xs; j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth j xs) = set xs - {xs ! j}; distinct (a # xs); j < length (a # xs)\<rbrakk> \<Longrightarrow> set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distinct []
j < length []

goal (2 subgoals):
 1. \<And>j. \<lbrakk>distinct []; j < length []\<rbrakk> \<Longrightarrow> set (remove_nth j []) = set [] - {[] ! j}
 2. \<And>a xs j. \<lbrakk>\<And>j. \<lbrakk>distinct xs; j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth j xs) = set xs - {xs ! j}; distinct (a # xs); j < length (a # xs)\<rbrakk> \<Longrightarrow> set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct []
j < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distinct []
j < length []

goal (1 subgoal):
 1. set (remove_nth j []) = set [] - {[] ! j}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (remove_nth j []) = set [] - {[] ! j}

goal (1 subgoal):
 1. \<And>a xs j. \<lbrakk>\<And>j. \<lbrakk>distinct xs; j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth j xs) = set xs - {xs ! j}; distinct (a # xs); j < length (a # xs)\<rbrakk> \<Longrightarrow> set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs j. \<lbrakk>\<And>j. \<lbrakk>distinct xs; j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth j xs) = set xs - {xs ! j}; distinct (a # xs); j < length (a # xs)\<rbrakk> \<Longrightarrow> set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>distinct xs; ?j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth ?j xs) = set xs - {xs ! ?j}
distinct (a # xs)
j < length (a # xs)

goal (1 subgoal):
 1. \<And>a xs j. \<lbrakk>\<And>j. \<lbrakk>distinct xs; j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth j xs) = set xs - {xs ! j}; distinct (a # xs); j < length (a # xs)\<rbrakk> \<Longrightarrow> set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>distinct xs; ?j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth ?j xs) = set xs - {xs ! ?j}
distinct (a # xs)
j < length (a # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct xs; ?j < length xs\<rbrakk> \<Longrightarrow> set (remove_nth ?j xs) = set xs - {xs ! ?j}
distinct (a # xs)
j < length (a # xs)

goal (1 subgoal):
 1. set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}
[PROOF STEP]
by (cases j) auto
[PROOF STATE]
proof (state)
this:
set (remove_nth j (a # xs)) = set (a # xs) - {(a # xs) ! j}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lists_lepoll_mono:
  assumes "A \<lesssim> B" shows "lists A \<lesssim> lists B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
obtain f where f: "inj_on f A" "f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>inj_on f A; f ` A \<subseteq> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson assms lepoll_def)
[PROOF STATE]
proof (state)
this:
inj_on f A
f ` A \<subseteq> B

goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on f A
f ` A \<subseteq> B

goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
have "inj_on (map f) (lists A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (map f) (lists A)
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
inj_on f A
f ` A \<subseteq> B

goal (1 subgoal):
 1. inj_on (map f) (lists A)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. \<forall>y\<in>A. f x = f y \<longrightarrow> x = y
f ` A \<subseteq> B

goal (1 subgoal):
 1. \<forall>x\<in>lists A. \<forall>y\<in>lists A. map f x = map f y \<longrightarrow> x = y
[PROOF STEP]
by clarsimp (metis list.inj_map_strong)
[PROOF STATE]
proof (state)
this:
inj_on (map f) (lists A)

goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on f A
f ` A \<subseteq> B
inj_on (map f) (lists A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on f A
f ` A \<subseteq> B
inj_on (map f) (lists A)

goal (1 subgoal):
 1. lists A \<lesssim> lists B
[PROOF STEP]
unfolding lepoll_def
[PROOF STATE]
proof (prove)
using this:
inj_on f A
f ` A \<subseteq> B
inj_on (map f) (lists A)

goal (1 subgoal):
 1. \<exists>f. inj_on f (lists A) \<and> f ` lists A \<subseteq> lists B
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
lists A \<lesssim> lists B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_segment_imp_Re_Im:
  fixes x::complex
  assumes "x\<in>closed_segment lb ub"
  shows "Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub"
        "Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub) &&& (Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
obtain u where x_u:"x=(1 - u) *\<^sub>R lb + u *\<^sub>R ub " and "0 \<le> u" "u \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u. \<lbrakk>x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub; 0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> closed_segment lb ub

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub; 0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding closed_segment_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {(1 - u) *\<^sub>R lb + u *\<^sub>R ub |u. 0 \<le> u \<and> u \<le> 1}

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub; 0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub
0 \<le> u
u \<le> 1

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
have "Re lb \<le> Re x" when "Re lb \<le> Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
have "Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
using x_u
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (1 subgoal):
 1. Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
have "... = Re (lb + u *\<^sub>R (ub - lb))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Re (lb + u *\<^sub>R (ub - lb))
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Re (lb + u *\<^sub>R (ub - lb))

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Re (lb + u *\<^sub>R (ub - lb))

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
have "... = Re lb + u * (Re ub - Re lb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (lb + u *\<^sub>R (ub - lb)) = Re lb + u * (Re ub - Re lb)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re (lb + u *\<^sub>R (ub - lb)) = Re lb + u * (Re ub - Re lb)

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (lb + u *\<^sub>R (ub - lb)) = Re lb + u * (Re ub - Re lb)

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
have "... \<ge> Re lb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re lb \<le> Re lb + u * (Re ub - Re lb)
[PROOF STEP]
using \<open>u\<ge>0\<close> \<open>Re lb \<le> Re ub\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
Re lb \<le> Re ub

goal (1 subgoal):
 1. Re lb \<le> Re lb + u * (Re ub - Re lb)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re lb + u * (Re ub - Re lb)

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Re lb \<le> Re x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re lb \<le> Re x

goal (1 subgoal):
 1. Re lb \<le> Re x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
have "Im lb \<le> Im x" when "Im lb \<le> Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
have "Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
using x_u
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (1 subgoal):
 1. Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
have "... = Im (lb + u *\<^sub>R (ub - lb))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Im (lb + u *\<^sub>R (ub - lb))
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Im (lb + u *\<^sub>R (ub - lb))

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = Im (lb + u *\<^sub>R (ub - lb))

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
have "... = Im lb + u * (Im ub - Im lb)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (lb + u *\<^sub>R (ub - lb)) = Im lb + u * (Im ub - Im lb)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im (lb + u *\<^sub>R (ub - lb)) = Im lb + u * (Im ub - Im lb)

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im (lb + u *\<^sub>R (ub - lb)) = Im lb + u * (Im ub - Im lb)

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
have "... \<ge> Im lb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im lb \<le> Im lb + u * (Im ub - Im lb)
[PROOF STEP]
using \<open>u\<ge>0\<close> \<open>Im lb \<le> Im ub\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
Im lb \<le> Im ub

goal (1 subgoal):
 1. Im lb \<le> Im lb + u * (Im ub - Im lb)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im lb \<le> Im lb + u * (Im ub - Im lb)

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Im lb \<le> Im x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im lb \<le> Im x

goal (1 subgoal):
 1. Im lb \<le> Im x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Im lb \<le> Im x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
have "Re x \<le> Re ub" when "Re lb \<le> Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
have "Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
using x_u
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (1 subgoal):
 1. Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re x = Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
have "... = (1 - u) * Re lb + u * Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Re lb + u * Re ub
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Re lb + u * Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Re lb + u * Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
have "... \<le> (1 - u) * Re ub + u * Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) * Re lb + u * Re ub \<le> (1 - u) * Re ub + u * Re ub
[PROOF STEP]
using \<open>u\<le>1\<close> \<open>Re lb \<le> Re ub\<close>
[PROOF STATE]
proof (prove)
using this:
u \<le> 1
Re lb \<le> Re ub

goal (1 subgoal):
 1. (1 - u) * Re lb + u * Re ub \<le> (1 - u) * Re ub + u * Re ub
[PROOF STEP]
by (auto simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
(1 - u) * Re lb + u * Re ub \<le> (1 - u) * Re ub + u * Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - u) * Re lb + u * Re ub \<le> (1 - u) * Re ub + u * Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
have "... = Re ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) * Re ub + u * Re ub = Re ub
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 - u) * Re ub + u * Re ub = Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Re x \<le> Re ub
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re x \<le> Re ub

goal (1 subgoal):
 1. Re x \<le> Re ub
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Re x \<le> Re ub

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re ub \<Longrightarrow> Re x \<le> Re ub

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re ub \<Longrightarrow> Re x \<le> Re ub

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
have "Im x \<le> Im ub" when "Im lb \<le> Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
have "Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
using x_u
[PROOF STATE]
proof (prove)
using this:
x = (1 - u) *\<^sub>R lb + u *\<^sub>R ub

goal (1 subgoal):
 1. Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im x = Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub)

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
have "... = (1 - u) * Im lb + u * Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Im lb + u * Im ub
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Im lb + u * Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im ((1 - u) *\<^sub>R lb + u *\<^sub>R ub) = (1 - u) * Im lb + u * Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
have "... \<le> (1 - u) * Im ub + u * Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) * Im lb + u * Im ub \<le> (1 - u) * Im ub + u * Im ub
[PROOF STEP]
using \<open>u\<le>1\<close> \<open>Im lb \<le> Im ub\<close>
[PROOF STATE]
proof (prove)
using this:
u \<le> 1
Im lb \<le> Im ub

goal (1 subgoal):
 1. (1 - u) * Im lb + u * Im ub \<le> (1 - u) * Im ub + u * Im ub
[PROOF STEP]
by (auto simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
(1 - u) * Im lb + u * Im ub \<le> (1 - u) * Im ub + u * Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - u) * Im lb + u * Im ub \<le> (1 - u) * Im ub + u * Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
have "... = Im ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) * Im ub + u * Im ub = Im ub
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 - u) * Im ub + u * Im ub = Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Im x \<le> Im ub
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Im x \<le> Im ub

goal (1 subgoal):
 1. Im x \<le> Im ub
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Im x \<le> Im ub

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Im lb \<le> Im ub \<Longrightarrow> Im x \<le> Im ub

goal (2 subgoals):
 1. Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
 2. Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x
Re lb \<le> Re ub \<Longrightarrow> Re x \<le> Re ub
Im lb \<le> Im ub \<Longrightarrow> Im x \<le> Im ub
[PROOF STEP]
show
      "Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub"
      "Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub"
[PROOF STATE]
proof (prove)
using this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x
Re lb \<le> Re ub \<Longrightarrow> Re x \<le> Re ub
Im lb \<le> Im ub \<Longrightarrow> Im x \<le> Im ub

goal (1 subgoal):
 1. (Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub) &&& (Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re lb \<le> Re ub \<Longrightarrow> Re lb \<le> Re x \<and> Re x \<le> Re ub
Im lb \<le> Im ub \<Longrightarrow> Im lb \<le> Im x \<and> Im x \<le> Im ub

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma raw_has_prodI_bounded:
  fixes f :: "nat \<Rightarrow> real"
  assumes pos: "\<And>n. 1 \<le> f n"
    and le: "\<And>n. (\<Prod>i<n. f i) \<le> x"
  shows "\<exists>p. raw_has_prod f 0 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. raw_has_prod f 0 p
[PROOF STEP]
unfolding raw_has_prod_def add_0_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> p \<and> p \<noteq> 0
[PROOF STEP]
proof (rule exI LIMSEQ_incseq_SUP conjI)+
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. bdd_above (range (\<lambda>n. prod f {..n}))
 2. incseq (\<lambda>n. prod f {..n})
 3. (SUP i. prod f {..i}) \<noteq> 0
[PROOF STEP]
show "bdd_above (range (\<lambda>n. prod f {..n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. prod f {..n}))
[PROOF STEP]
by (metis bdd_aboveI2 le lessThan_Suc_atMost)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. prod f {..n}))

goal (2 subgoals):
 1. incseq (\<lambda>n. prod f {..n})
 2. (SUP i. prod f {..i}) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bdd_above (range (\<lambda>n. prod f {..n}))
[PROOF STEP]
have "(SUP i. prod f {..i}) > 0"
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. prod f {..n}))

goal (1 subgoal):
 1. 0 < (SUP i. prod f {..i})
[PROOF STEP]
by (metis UNIV_I cSUP_upper less_le_trans pos prod_pos zero_less_one)
[PROOF STATE]
proof (state)
this:
0 < (SUP i. prod f {..i})

goal (2 subgoals):
 1. incseq (\<lambda>n. prod f {..n})
 2. (SUP i. prod f {..i}) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < (SUP i. prod f {..i})
[PROOF STEP]
show "(SUP i. prod f {..i}) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < (SUP i. prod f {..i})

goal (1 subgoal):
 1. (SUP i. prod f {..i}) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(SUP i. prod f {..i}) \<noteq> 0

goal (1 subgoal):
 1. incseq (\<lambda>n. prod f {..n})
[PROOF STEP]
show "incseq (\<lambda>n. prod f {..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. prod f {..n})
[PROOF STEP]
using pos order_trans [OF zero_le_one]
[PROOF STATE]
proof (prove)
using this:
1 \<le> f ?n
(1::?'a1) \<le> ?z \<Longrightarrow> (0::?'a1) \<le> ?z

goal (1 subgoal):
 1. incseq (\<lambda>n. prod f {..n})
[PROOF STEP]
by (auto simp: mono_def intro!: prod_mono2)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. prod f {..n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multTensor2_bis [simp]:
  assumes a1:"dim_row A = 2" and a2:"dim_col A = 1" and a3:"dim_row B = 2" and a4:"dim_col B = 1"
  shows "mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) =
[[A $$ (0,0) * B $$ (0,0), A $$ (0,0) *  B $$ (1,0), A $$ (1,0) * B $$ (0,0), A $$ (1,0) * B $$ (1,0)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
have "mat_to_cols_list A = [[A $$ (0,0), A $$ (1,0)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_to_cols_list A = [[A $$ (0, 0), A $$ (1, 0)]]
[PROOF STEP]
by (auto simp: a1 a2 mat_to_cols_list_def) (simp add: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list A = [[A $$ (0, 0), A $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat_to_cols_list A = [[A $$ (0, 0), A $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
have f2:"mat_to_cols_list B = [[B $$ (0,0), B $$ (1,0)]]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_to_cols_list B = [[B $$ (0, 0), B $$ (1, 0)]]
[PROOF STEP]
by (auto simp: a3 a4 mat_to_cols_list_def) (simp add: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
mat_to_cols_list B = [[B $$ (0, 0), B $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat_to_cols_list A = [[A $$ (0, 0), A $$ (1, 0)]]
mat_to_cols_list B = [[B $$ (0, 0), B $$ (1, 0)]]
[PROOF STEP]
have "mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) =
                   mult.Tensor (*) [[A $$ (0,0), A $$ (1,0)]] [[B $$ (0,0), B $$ (1,0)]]"
[PROOF STATE]
proof (prove)
using this:
mat_to_cols_list A = [[A $$ (0, 0), A $$ (1, 0)]]
mat_to_cols_list B = [[B $$ (0, 0), B $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = mult.Tensor (*) [[A $$ (0, 0), A $$ (1, 0)]] [[B $$ (0, 0), B $$ (1, 0)]]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = mult.Tensor (*) [[A $$ (0, 0), A $$ (1, 0)]] [[B $$ (0, 0), B $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = mult.Tensor (*) [[A $$ (0, 0), A $$ (1, 0)]] [[B $$ (0, 0), B $$ (1, 0)]]

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
using mult.Tensor_def[of "(1::complex)" "(*)"] mult.times_def[of "(1::complex)" "(*)"]
[PROOF STATE]
proof (prove)
using this:
mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = mult.Tensor (*) [[A $$ (0, 0), A $$ (1, 0)]] [[B $$ (0, 0), B $$ (1, 0)]]
Matrix_Tensor.mult 1 (*) \<Longrightarrow> mult.Tensor (*) \<equiv> rec_list (\<lambda>xs. []) (\<lambda>x xs xsa ys. mult.vec_mat_Tensor (*) x ys @ xsa ys)
Matrix_Tensor.mult 1 (*) \<Longrightarrow> mult.times (*) \<equiv> \<lambda>uu uua. rec_list (\<lambda>n. []) (\<lambda>y ys ysa n. n * y # ysa n) uua uu

goal (1 subgoal):
 1. mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]
[PROOF STEP]
by (smt append_self_conv list.simps(6) mult.Tensor.simps(2) mult.vec_mat_Tensor.simps(1)
mult.vec_mat_Tensor.simps(2) plus_mult_cpx plus_mult_def tensor_prod_2)
[PROOF STATE]
proof (state)
this:
mult.Tensor (*) (mat_to_cols_list A) (mat_to_cols_list B) = [[A $$ (0, 0) * B $$ (0, 0), A $$ (0, 0) * B $$ (1, 0), A $$ (1, 0) * B $$ (0, 0), A $$ (1, 0) * B $$ (1, 0)]]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_one_enat_neq:
  "\<not> 0 = (1::enat)"
  "\<not> 1 = (0::enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> 1 &&& 1 \<noteq> 0
[PROOF STEP]
unfolding zero_enat_def one_enat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enat 0 \<noteq> enat 1 &&& enat 1 \<noteq> enat 0
[PROOF STEP]
by simp_all


[STATEMENT]
lemma (in linorder) sorted_wrt_map_linord [simp] :
  "sorted_wrt (\<lambda>(x::'a \<times> 'b) y. fst x \<le> fst y) l
  \<longleftrightarrow> sorted (map fst l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<lambda>x y. fst x \<le> fst y) l = sorted (map fst l)
[PROOF STEP]
by (simp add: sorted_wrt_map)


[STATEMENT]
lemma tensor_comm[simp]:
fixes A::"'a::ab_semigroup_add tensor"
shows "A + B = B + A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A + B = B + A
[PROOF STEP]
proof (cases "dims A = dims B")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dims A = dims B \<Longrightarrow> A + B = B + A
 2. dims A \<noteq> dims B \<Longrightarrow> A + B = B + A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
dims A = dims B

goal (2 subgoals):
 1. dims A = dims B \<Longrightarrow> A + B = B + A
 2. dims A \<noteq> dims B \<Longrightarrow> A + B = B + A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dims A = dims B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dims A = dims B

goal (1 subgoal):
 1. A + B = B + A
[PROOF STEP]
unfolding plus_def plus_base_def
[PROOF STATE]
proof (prove)
using this:
dims A = dims B

goal (1 subgoal):
 1. (if dims A = dims B then tensor_from_vec (dims A) (vec_plus (vec A) (vec B)) else undefined) = (if dims B = dims A then tensor_from_vec (dims B) (vec_plus (vec B) (vec A)) else undefined)
[PROOF STEP]
using add.commute lookup_plus[OF True] plus_dim1[OF True] tensor_lookup_eqI[OF True] vec_plus[OF True]
[PROOF STATE]
proof (prove)
using this:
dims A = dims B
?a + ?b = ?b + ?a
?is \<lhd> dims A \<Longrightarrow> lookup (A + B) ?is = lookup A ?is + lookup B ?is
dims (A + B) = dims A
(\<And>is. is \<lhd> dims A \<Longrightarrow> lookup A is = lookup B is) \<Longrightarrow> A = B
vec (A + B) = vec_plus (vec A) (vec B)

goal (1 subgoal):
 1. (if dims A = dims B then tensor_from_vec (dims A) (vec_plus (vec A) (vec B)) else undefined) = (if dims B = dims A then tensor_from_vec (dims B) (vec_plus (vec B) (vec A)) else undefined)
[PROOF STEP]
by (metis lookup_plus plus_dim1 tensor_lookup_eqI vec_plus)
[PROOF STATE]
proof (state)
this:
A + B = B + A

goal (1 subgoal):
 1. dims A \<noteq> dims B \<Longrightarrow> A + B = B + A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dims A \<noteq> dims B \<Longrightarrow> A + B = B + A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
dims A \<noteq> dims B

goal (1 subgoal):
 1. dims A \<noteq> dims B \<Longrightarrow> A + B = B + A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dims A \<noteq> dims B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dims A \<noteq> dims B

goal (1 subgoal):
 1. A + B = B + A
[PROOF STEP]
unfolding plus_def plus_base_def
[PROOF STATE]
proof (prove)
using this:
dims A \<noteq> dims B

goal (1 subgoal):
 1. (if dims A = dims B then tensor_from_vec (dims A) (vec_plus (vec A) (vec B)) else undefined) = (if dims B = dims A then tensor_from_vec (dims B) (vec_plus (vec B) (vec A)) else undefined)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A + B = B + A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma encode12_lt:
  assumes "i < d1" "j < d2"
  shows "encode12 (i, j) < d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. encode12 (i, j) < d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < d1
j < d2

goal (1 subgoal):
 1. encode12 (i, j) < d
[PROOF STEP]
unfolding encode12.simps d_def d1_def d2_def dims1_def dims2_def
[PROOF STATE]
proof (prove)
using this:
i < prod_list (nths dims vars)
j < prod_list (nths dims (- vars))

goal (1 subgoal):
 1. digit_decode dims (weave vars (digit_encode (nths dims vars) i) (digit_encode (nths dims (- vars)) j)) < prod_list dims
[PROOF STEP]
by (simp add: digit_decode_lt digit_encode_valid_index valid_index_weave(1))


[STATEMENT]
lemma unity_root_diff: "unity_root k (m - n) = unity_root k m * cnj (unity_root k n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unity_root k (m - n) = unity_root k m * cnj (unity_root k n)
[PROOF STEP]
using unity_root_add[of k m "-n"]
[PROOF STATE]
proof (prove)
using this:
unity_root k (m + - n) = unity_root k m * unity_root k (- n)

goal (1 subgoal):
 1. unity_root k (m - n) = unity_root k m * cnj (unity_root k n)
[PROOF STEP]
by (simp add: unity_root_uminus)


[STATEMENT]
lemma disjoint_family_subset: "disjoint_family A \<Longrightarrow> (\<And>x. B x \<subseteq> A x) \<Longrightarrow> disjoint_family B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>disjoint_family A; \<And>x. B x \<subseteq> A x\<rbrakk> \<Longrightarrow> disjoint_family B
[PROOF STEP]
by (force simp add: disjoint_family_on_def)