[STATEMENT]
lemma of_nat_diff [simp]: "n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
proof (induct m arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. n \<le> 0 \<Longrightarrow> \<guillemotleft>0 - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>0\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
 2. \<And>m n. \<lbrakk>\<And>n. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>; n \<le> Suc m\<rbrakk> \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n \<le> 0

goal (2 subgoals):
 1. \<And>n. n \<le> 0 \<Longrightarrow> \<guillemotleft>0 - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>0\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
 2. \<And>m n. \<lbrakk>\<And>n. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>; n \<le> Suc m\<rbrakk> \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<le> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n \<le> 0

goal (1 subgoal):
 1. \<guillemotleft>0 - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>0\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by (simp add: minus_eq)
[PROOF STATE]
proof (state)
this:
\<guillemotleft>0 - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>0\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>\<And>n. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>; n \<le> Suc m\<rbrakk> \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m n. \<lbrakk>\<And>n. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>; n \<le> Suc m\<rbrakk> \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
case Suc': (Suc m)
[PROOF STATE]
proof (state)
this:
?n \<le> m \<Longrightarrow> \<guillemotleft>m - ?n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>?n\<guillemotright>\<^sub>\<nat>
n \<le> Suc m

goal (1 subgoal):
 1. \<And>m n. \<lbrakk>\<And>n. n \<le> m \<Longrightarrow> \<guillemotleft>m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>; n \<le> Suc m\<rbrakk> \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
 2. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by (simp add: minus_eq)
[PROOF STATE]
proof (state)
this:
\<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
n = Suc k

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
with Suc'
[PROOF STATE]
proof (chain)
picking this:
?n \<le> m \<Longrightarrow> \<guillemotleft>m - ?n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>?n\<guillemotright>\<^sub>\<nat>
n \<le> Suc m
n = Suc k
[PROOF STEP]
have "\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
using this:
?n \<le> m \<Longrightarrow> \<guillemotleft>m - ?n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>?n\<guillemotright>\<^sub>\<nat>
n \<le> Suc m
n = Suc k

goal (1 subgoal):
 1. \<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
have "\<dots> = \<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat> = \<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>)
[PROOF STEP]
by (simp add: r_neg)
[PROOF STATE]
proof (state)
this:
\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat> = \<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat> = \<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
have "\<dots> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>) = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by (simp add: minus_eq minus_add a_ac)
[PROOF STATE]
proof (state)
this:
\<one> \<oplus> \<ominus> \<one> \<oplus> (\<guillemotleft>m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>k\<guillemotright>\<^sub>\<nat>) = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>

goal (1 subgoal):
 1. \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
\<guillemotleft>Suc m - Suc k\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>Suc k\<guillemotright>\<^sub>\<nat>
n = Suc k

goal (1 subgoal):
 1. \<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<guillemotleft>Suc m - n\<guillemotright>\<^sub>\<nat> = \<guillemotleft>Suc m\<guillemotright>\<^sub>\<nat> \<ominus> \<guillemotleft>n\<guillemotright>\<^sub>\<nat>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma antiderivative_continuous:
  fixes q b :: real
  assumes "continuous_on {a..b} f"
  obtains g where "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative (f x::_::banach)) (at x within {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. (\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative f x) (at x within {a..b})) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using integral_has_vector_derivative[OF assms]
[PROOF STATE]
proof (prove)
using this:
?x \<in> {a..b} \<Longrightarrow> ((\<lambda>u. integral {a..u} f) has_vector_derivative f ?x) (at ?x within {a..b})

goal (1 subgoal):
 1. (\<And>g. (\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative f x) (at x within {a..b})) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma exp_at_top: "LIM x at_top. exp x :: real :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim exp at_top at_top
[PROOF STEP]
by (rule filterlim_at_top_at_top[where Q="\<lambda>x. True" and P="\<lambda>x. 0 < x" and g=ln])
    (auto intro: eventually_gt_at_top)


[STATEMENT]
lemma last_index_size_conv:
  "size xs = n \<Longrightarrow> (last_index xs x = n) = (x \<notin> set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = n \<Longrightarrow> (last_index xs x = n) = (x \<notin> set xs)
[PROOF STEP]
apply(auto simp: last_index_def index_size_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = length xs; length xs - Suc (index (rev xs) x) = length xs; x \<in> set xs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply(drule length_pos_if_in_set)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n = length xs; length xs - Suc (index (rev xs) x) = length xs; 0 < length xs\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wf_graph_union_edges: "\<lbrakk> wf_graph \<lparr> nodes = V, edges = E \<rparr>; wf_graph \<lparr> nodes = V, edges=E'\<rparr> \<rbrakk> \<Longrightarrow>
     wf_graph \<lparr> nodes = V, edges=E \<union> E'\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_graph \<lparr>nodes = V, edges = E\<rparr>; wf_graph \<lparr>nodes = V, edges = E'\<rparr>\<rbrakk> \<Longrightarrow> wf_graph \<lparr>nodes = V, edges = E \<union> E'\<rparr>
[PROOF STEP]
by(auto simp add: wf_graph_def)


[STATEMENT]
lemma sumPairsInverse:
  assumes "runiq (P^-1)"
  shows "sum (f \<circ> snd) P = sum f (Range P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (f \<circ> snd) P = sum f (Range P)
[PROOF STEP]
using assms lm062 converse_converse rightUniqueInjectiveOnFirst rightUniqueInjectiveOnFirst
        sum.reindex snd_eq_Range
[PROOF STATE]
proof (prove)
using this:
runiq (P\<inverse>)
inj_on fst ?P = inj_on snd (?P\<inverse>)
(?r\<inverse>)\<inverse> = ?r
runiq ?P = inj_on fst ?P
runiq ?P = inj_on fst ?P
inj_on ?h ?A \<Longrightarrow> sum ?g (?h ` ?A) = sum (?g \<circ> ?h) ?A
snd ` ?R = Range ?R

goal (1 subgoal):
 1. sum (f \<circ> snd) P = sum f (Range P)
[PROOF STEP]
by metis


[STATEMENT]
lemma mult_poly_p'_mult_poly_spec:
  \<open>(p, p') \<in> mset_poly_rel \<Longrightarrow> (q, q') \<in> mset_poly_rel \<Longrightarrow>
  mult_poly_p' p q \<le> \<Down>mset_poly_rel (mult_poly_spec p' q')\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(p, p') \<in> mset_poly_rel; (q, q') \<in> mset_poly_rel\<rbrakk> \<Longrightarrow> mult_poly_p' p q \<le> \<Down> mset_poly_rel (mult_poly_spec p' q')
[PROOF STEP]
unfolding mult_poly_p'_def mult_poly_spec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(p, p') \<in> mset_poly_rel; (q, q') \<in> mset_poly_rel\<rbrakk> \<Longrightarrow> SPEC (\<lambda>r. (mult_poly_p q)\<^sup>*\<^sup>* (p, {#}) ({#}, r)) \<bind> (\<lambda>pq. SPEC (normalize_poly_p\<^sup>*\<^sup>* pq)) \<le> \<Down> mset_poly_rel (SPEC (\<lambda>r. p' * q' - r \<in> More_Modules.ideal polynomial_bool))
[PROOF STEP]
apply refine_rcg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>(p, p') \<in> mset_poly_rel; (q, q') \<in> mset_poly_rel; pq \<in> {r. (mult_poly_p q)\<^sup>*\<^sup>* (p, {#}) ({#}, r)}\<rbrakk> \<Longrightarrow> SPEC (normalize_poly_p\<^sup>*\<^sup>* pq) \<le> \<Down> mset_poly_rel (SPEC (\<lambda>r. p' * q' - r \<in> More_Modules.ideal polynomial_bool))
[PROOF STEP]
apply (auto simp: mset_poly_rel_def dest!: rtranclp_mult_poly_p_mult_ideal_final)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>p' = polynomial_of_mset p; q' = polynomial_of_mset q; polynomial_of_mset pq - polynomial_of_mset p * polynomial_of_mset q \<in> More_Modules.ideal polynomial_bool\<rbrakk> \<Longrightarrow> SPEC (normalize_poly_p\<^sup>*\<^sup>* pq) \<le> \<Down> {(a, b). b = polynomial_of_mset a} (SPEC (\<lambda>r. polynomial_of_mset p * polynomial_of_mset q - r \<in> More_Modules.ideal polynomial_bool))
[PROOF STEP]
apply (intro RES_refine)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq s. \<lbrakk>p' = polynomial_of_mset p; q' = polynomial_of_mset q; polynomial_of_mset pq - polynomial_of_mset p * polynomial_of_mset q \<in> More_Modules.ideal polynomial_bool; s \<in> Collect (normalize_poly_p\<^sup>*\<^sup>* pq)\<rbrakk> \<Longrightarrow> \<exists>s'\<in>{r. polynomial_of_mset p * polynomial_of_mset q - r \<in> More_Modules.ideal polynomial_bool}. (s, s') \<in> {(a, b). b = polynomial_of_mset a}
[PROOF STEP]
using ideal.span_add_eq2 ideal.span_zero
[PROOF STATE]
proof (prove)
using this:
?y \<in> More_Modules.ideal ?S \<Longrightarrow> (?x + ?y \<in> More_Modules.ideal ?S) = (?x \<in> More_Modules.ideal ?S)
(0::?'a) \<in> More_Modules.ideal ?S

goal (1 subgoal):
 1. \<And>pq s. \<lbrakk>p' = polynomial_of_mset p; q' = polynomial_of_mset q; polynomial_of_mset pq - polynomial_of_mset p * polynomial_of_mset q \<in> More_Modules.ideal polynomial_bool; s \<in> Collect (normalize_poly_p\<^sup>*\<^sup>* pq)\<rbrakk> \<Longrightarrow> \<exists>s'\<in>{r. polynomial_of_mset p * polynomial_of_mset q - r \<in> More_Modules.ideal polynomial_bool}. (s, s') \<in> {(a, b). b = polynomial_of_mset a}
[PROOF STEP]
by (fastforce dest!: rtranclp_normalize_poly_p_poly_of_mset intro: ideal.span_add_eq2)


[STATEMENT]
lemma closed_err_lift2_conv:
  "closed (err A) (lift2 f) = (\<forall>x\<in> A. \<forall>y\<in> A. x +_f y \<in> err A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (err A) (lift2 f) = (\<forall>x\<in>A. \<forall>y\<in>A. x \<squnion>\<^bsub>f\<^esub> y \<in> err A)
[PROOF STEP]
apply (unfold closed_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>err A. \<forall>y\<in>err A. x \<squnion>\<^bsub>lift2 f\<^esub> y \<in> err A) = (\<forall>x\<in>A. \<forall>y\<in>A. x \<squnion>\<^bsub>f\<^esub> y \<in> err A)
[PROOF STEP]
apply (simp add: err_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in PolynRg) deg_mult_pols1:"\<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R\<rbrakk>
       \<Longrightarrow>
          deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (case_tac "p = \<zero>\<^bsub>R\<^esub>", simp add:ring_times_0_x, simp add:deg_def,
       rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Idomain S; \<zero> \<in> carrier R; q \<in> carrier R; p = \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> - \<infinity> = - \<infinity> + an (deg_n R S X q)
 2. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (simp add:an_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (case_tac "q = \<zero>\<^bsub>R\<^esub>", simp add:ring_times_x_0, simp add:deg_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Idomain S; p \<in> carrier R; \<zero> \<in> carrier R; p \<noteq> \<zero>; q = \<zero>\<rbrakk> \<Longrightarrow> - \<infinity> = an (deg_n R S X p) + - \<infinity>
 2. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (simp add:an_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (frule deg_mult_pols[of p q], assumption+, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<cdot>\<^sub>r q \<noteq> \<zero>; deg_n R S X (p \<cdot>\<^sub>r q) = deg_n R S X p + deg_n R S X q\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (frule Idomain.idom_is_ring[of "S"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<cdot>\<^sub>r q \<noteq> \<zero>; deg_n R S X (p \<cdot>\<^sub>r q) = deg_n R S X p + deg_n R S X q; Ring S\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (frule ring_tOp_closed[of p q], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Idomain S; p \<in> carrier R; q \<in> carrier R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<cdot>\<^sub>r q \<noteq> \<zero>; deg_n R S X (p \<cdot>\<^sub>r q) = deg_n R S X p + deg_n R S X q; Ring S; p \<cdot>\<^sub>r q \<in> carrier R\<rbrakk> \<Longrightarrow> deg R S X (p \<cdot>\<^sub>r q) = deg R S X p + deg R S X q
[PROOF STEP]
apply (simp add:deg_an an_def a_zpz)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma chain_sym_obtain2:
  assumes "[f\<leadsto>X|a..c]"
  obtains g where "[g\<leadsto>X|c..a]" and "g=(\<lambda>n. f (card X - 1 - n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>[g\<leadsto>X|c .. a]; g = (\<lambda>n. f (card X - 1 - n))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms chain_sym2
[PROOF STATE]
proof (prove)
using this:
[f\<leadsto>X|a .. c]
[?f\<leadsto>?X|?a .. ?c] \<Longrightarrow> [\<lambda>n. ?f (card ?X - 1 - n)\<leadsto>?X|?c .. ?a]

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>[g\<leadsto>X|c .. a]; g = (\<lambda>n. f (card X - 1 - n))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma open_halfspace_gt: "open {x. inner a x > b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {x. b < a \<bullet> x}
[PROOF STEP]
by (simp add: open_Collect_less continuous_on_inner)


[STATEMENT]
lemma sublist_not_empty: \<open>\<lbrakk>i \<le> j; j < length xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> sublist xs i j \<noteq> []\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> j; j < length xs; xs \<noteq> []\<rbrakk> \<Longrightarrow> WB_Sort.sublist xs i j \<noteq> []
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> WB_Sort.sublist xs i j \<noteq> []
[PROOF STEP]
apply (rewrite List.length_greater_0_conv[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> 0 < length (WB_Sort.sublist xs i j)
[PROOF STEP]
apply (rewrite sublist_length)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> i \<le> j
 2. \<lbrakk>i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> j < length xs
 3. \<lbrakk>i \<le> j; j < length xs\<rbrakk> \<Longrightarrow> 0 < 1 + j - i
[PROOF STEP]
by auto


[STATEMENT]
lemma canonical_separator_distinguishing_transitions_right_containment :
  assumes "t \<in> (distinguishing_transitions_right M q1 q2)"
      and "q1 \<in> states M" and "q2 \<in> states M"
  shows "t \<in> transitions (canonical_separator M q1 q2)" (is "t \<in> transitions ?C")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> FSM.transitions (canonical_separator M q1 q2)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
t \<in> distinguishing_transitions_right M q1 q2

goal (1 subgoal):
 1. t \<in> FSM.transitions (canonical_separator M q1 q2)
[PROOF STEP]
unfolding canonical_separator_transitions_def[OF assms(2,3)]
[PROOF STATE]
proof (prove)
using this:
t \<in> distinguishing_transitions_right M q1 q2

goal (1 subgoal):
 1. t \<in> {(Inl (q1', q2'), x, y, Inl (q1'', q2'')) |q1' q2' x y q1'' q2''. ((q1', q2'), x, y, q1'', q2'') \<in> FSM.transitions (Product_FSM.product (from_FSM M q1) (from_FSM M q2))} \<union> distinguishing_transitions_left M q1 q2 \<union> distinguishing_transitions_right M q1 q2
[PROOF STEP]
by blast


[STATEMENT]
lemma (in sigma_finite_measure) emeasure_pair_measure:
  assumes "X \<in> sets (N \<Otimes>\<^sub>M M)"
  shows "emeasure (N \<Otimes>\<^sub>M M) X = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)" (is "_ = ?\<mu> X")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (N \<Otimes>\<^sub>M M) X = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N
[PROOF STEP]
proof (rule emeasure_measure_of[OF pair_measure_def])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
 2. positive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)
 3. countably_additive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)
 4. X \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
show "positive (sets (N \<Otimes>\<^sub>M M)) ?\<mu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>a. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator a (x, y) \<partial>M \<partial>N)
[PROOF STEP]
by (auto simp: positive_def)
[PROOF STATE]
proof (state)
this:
positive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>a. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator a (x, y) \<partial>M \<partial>N)

goal (3 subgoals):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
 2. countably_additive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)
 3. X \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
have eq[simp]: "\<And>A x y. indicator A (x, y) = indicator (Pair x -` A) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A x y. indicator A (x, y) = indicator (Pair x -` A) y
[PROOF STEP]
by (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
indicator ?A (?x, ?y) = indicator (Pair ?x -` ?A) ?y

goal (3 subgoals):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
 2. countably_additive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>X. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator X (x, y) \<partial>M \<partial>N)
 3. X \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
show "countably_additive (sets (N \<Otimes>\<^sub>M M)) ?\<mu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countably_additive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>a. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator a (x, y) \<partial>M \<partial>N)
[PROOF STEP]
proof (rule countably_additiveI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
fix F :: "nat \<Rightarrow> ('b \<times> 'a) set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
assume F: "range F \<subseteq> sets (N \<Otimes>\<^sub>M M)" "disjoint_family F"
[PROOF STATE]
proof (state)
this:
range F \<subseteq> sets (N \<Otimes>\<^sub>M M)
disjoint_family F

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
from F
[PROOF STATE]
proof (chain)
picking this:
range F \<subseteq> sets (N \<Otimes>\<^sub>M M)
disjoint_family F
[PROOF STEP]
have *: "\<And>i. F i \<in> sets (N \<Otimes>\<^sub>M M)"
[PROOF STATE]
proof (prove)
using this:
range F \<subseteq> sets (N \<Otimes>\<^sub>M M)
disjoint_family F

goal (1 subgoal):
 1. \<And>i. F i \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F ?i1 \<in> sets (N \<Otimes>\<^sub>M M)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
F ?i1 \<in> sets (N \<Otimes>\<^sub>M M)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
have "\<And>x. disjoint_family (\<lambda>i. Pair x -` F i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. disjoint_family (\<lambda>i. Pair x -` F i)
[PROOF STEP]
by (intro disjoint_family_on_bisimulation[OF F(2)]) auto
[PROOF STATE]
proof (state)
this:
disjoint_family (\<lambda>i. Pair ?x1 -` F i)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
disjoint_family (\<lambda>i. Pair ?x1 -` F i)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
have "\<And>x. range (\<lambda>i. Pair x -` F i) \<subseteq> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. range (\<lambda>i. Pair x -` F i) \<subseteq> sets M
[PROOF STEP]
using F
[PROOF STATE]
proof (prove)
using this:
range F \<subseteq> sets (N \<Otimes>\<^sub>M M)
disjoint_family F

goal (1 subgoal):
 1. \<And>x. range (\<lambda>i. Pair x -` F i) \<subseteq> sets M
[PROOF STEP]
by (auto simp: sets_Pair1)
[PROOF STATE]
proof (state)
this:
range (\<lambda>i. Pair ?x1 -` F i) \<subseteq> sets M

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (N \<Otimes>\<^sub>M M); disjoint_family A; \<Union> (range A) \<in> sets (N \<Otimes>\<^sub>M M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (A i) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range A)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
F ?i1 \<in> sets (N \<Otimes>\<^sub>M M)
disjoint_family (\<lambda>i. Pair ?x1 -` F i)
range (\<lambda>i. Pair ?x1 -` F i) \<subseteq> sets M
[PROOF STEP]
show "(\<Sum>n. ?\<mu> (F n)) = ?\<mu> (\<Union>i. F i)"
[PROOF STATE]
proof (prove)
using this:
F ?i1 \<in> sets (N \<Otimes>\<^sub>M M)
disjoint_family (\<lambda>i. Pair ?x1 -` F i)
range (\<lambda>i. Pair ?x1 -` F i) \<subseteq> sets M

goal (1 subgoal):
 1. (\<Sum>n. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (F n) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range F)) (x, y) \<partial>M \<partial>N
[PROOF STEP]
by (auto simp add: nn_integral_suminf[symmetric] vimage_UN suminf_emeasure
               intro!: nn_integral_cong nn_integral_indicator[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>n. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (F n) (x, y) \<partial>M \<partial>N) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator (\<Union> (range F)) (x, y) \<partial>M \<partial>N

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
countably_additive (sets (N \<Otimes>\<^sub>M M)) (\<lambda>a. \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator a (x, y) \<partial>M \<partial>N)

goal (2 subgoals):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
 2. X \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
show "{a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
[PROOF STEP]
using sets.space_closed[of N] sets.space_closed[of M]
[PROOF STATE]
proof (prove)
using this:
sets N \<subseteq> Pow (space N)
sets M \<subseteq> Pow (space M)

goal (1 subgoal):
 1. {a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a \<times> b |a b. a \<in> sets N \<and> b \<in> sets M} \<subseteq> Pow (space N \<times> space M)

goal (1 subgoal):
 1. X \<in> sets (N \<Otimes>\<^sub>M M)
[PROOF STEP]
qed fact


[STATEMENT]
lemma accept_eps_split: "accept_eps (R \<union> S) bs \<longleftrightarrow> accept_eps R bs \<or> accept_eps S bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. accept_eps (R \<union> S) bs = (accept_eps R bs \<or> accept_eps S bs)
[PROOF STEP]
by (auto simp add: accept_eps_def step_eps_closure_set_split)


[STATEMENT]
lemma compositional_rsp3:
  assumes "(R1 ===> R2 ===> R3) C C" and "(R4 ===> R5 ===> R6) C C"
  shows "(R1 OOO R4 ===> R2 OOO R5 ===> R3 OOO R6) C C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (R1 OOO R4 ===> R2 OOO R5 ===> R3 OOO R6) C C
[PROOF STEP]
by (auto intro!: rel_funI)
     (metis (full_types) assms rel_funE relcomppI)


[STATEMENT]
lemma  discounted_init:
  shows "\<forall>w. discounted_value r X 0 w = X 0 w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>w. discounted_value r X 0 w = X 0 w
[PROOF STEP]
unfolding discounted_value_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>w. discount_factor r 0 w * X 0 w = X 0 w
[PROOF STEP]
by (simp add: discount_factor_init)


[STATEMENT]
lemma snapshot_bound_leq_S:
  shows "
    problem_plan_bound (snapshot PROB (fmrestrict_set vs s))
    \<le> S vs lss PROB (fmrestrict_set vs s)
  "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> S vs lss PROB (fmrestrict_set vs s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> S vs lss PROB (fmrestrict_set vs s)
[PROOF STEP]
have "geq_arg (max :: nat \<Rightarrow> nat \<Rightarrow> nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geq_arg max
[PROOF STEP]
unfolding geq_arg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> max x y \<and> y \<le> max x y
[PROOF STEP]
using max.cobounded1
[PROOF STATE]
proof (prove)
using this:
?a \<le> max ?a ?b

goal (1 subgoal):
 1. \<forall>x y. x \<le> max x y \<and> y \<le> max x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
geq_arg max

goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> S vs lss PROB (fmrestrict_set vs s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
geq_arg max
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
geq_arg max

goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> S vs lss PROB (fmrestrict_set vs s)
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
geq_arg max

goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> wlp (\<lambda>x y. y \<in> state_successors (prob_proj PROB vs) x) (\<lambda>s. problem_plan_bound (snapshot PROB s)) max (\<lambda>x y. x + y + 1) (fmrestrict_set vs s) lss
[PROOF STEP]
using individual_weight_less_eq_lp[where
        g="max :: nat \<Rightarrow> nat \<Rightarrow> nat"
        and x="(fmrestrict_set vs s)" and R="(\<lambda>x y. y \<in> state_successors (prob_proj PROB vs) x)"
        and w="(\<lambda>s. problem_plan_bound (snapshot PROB s))" and f="(\<lambda>x y. x + y + 1)" and l=lss]
[PROOF STATE]
proof (prove)
using this:
geq_arg max
geq_arg max \<Longrightarrow> problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> wlp (\<lambda>x y. y \<in> state_successors (prob_proj PROB vs) x) (\<lambda>s. problem_plan_bound (snapshot PROB s)) max (\<lambda>x y. x + y + 1) (fmrestrict_set vs s) lss

goal (1 subgoal):
 1. problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> wlp (\<lambda>x y. y \<in> state_successors (prob_proj PROB vs) x) (\<lambda>s. problem_plan_bound (snapshot PROB s)) max (\<lambda>x y. x + y + 1) (fmrestrict_set vs s) lss
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
problem_plan_bound (snapshot PROB (fmrestrict_set vs s)) \<le> S vs lss PROB (fmrestrict_set vs s)

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>NOTE first argument of `top\_sorted\_abs` had to be wrapped into lambda.\<close>
\<comment> \<open>NOTE the type of `1` had to be restricted to `nat` to ensure the proofs for `geq\_arg` work.\<close>


[STATEMENT]
lemma or_list_semantic: "w \<Turnstile>\<^sub>n or_list xs \<longleftrightarrow> (\<exists>x \<in> set xs. w \<Turnstile>\<^sub>n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<Turnstile>\<^sub>n or_list xs = (\<exists>x\<in>set xs. w \<Turnstile>\<^sub>n x)
[PROOF STEP]
by (induction xs rule: rev_induct) auto


[STATEMENT]
lemma iT_Minus_icard_le: "icard (k \<ominus> I) \<le> icard I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard (k \<ominus> I) \<le> icard I
[PROOF STEP]
apply (case_tac "finite I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite I \<Longrightarrow> icard (k \<ominus> I) \<le> icard I
 2. infinite I \<Longrightarrow> icard (k \<ominus> I) \<le> icard I
[PROOF STEP]
apply (simp add: icard_finite iT_Minus_finite iT_Minus_card_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite I \<Longrightarrow> icard (k \<ominus> I) \<le> icard I
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma compos_aI_r:"\<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compos A f aI\<^bsub>A\<^esub> = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compos A f aI\<^bsub>A\<^esub> = f
[PROOF STEP]
apply (simp add:compos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compose (carrier A) f aI\<^bsub>A\<^esub> = f
[PROOF STEP]
apply (rule funcset_eq[of _ "carrier A"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compose (carrier A) f aI\<^bsub>A\<^esub> \<in> extensional (carrier A)
 2. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier A)
 3. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) f aI\<^bsub>A\<^esub> x = f x
[PROOF STEP]
apply (simp add:compose_def extensional_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier A)
 2. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) f aI\<^bsub>A\<^esub> x = f x
[PROOF STEP]
apply (simp add:aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) f aI\<^bsub>A\<^esub> x = f x
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; x \<in> carrier A\<rbrakk> \<Longrightarrow> compose (carrier A) f aI\<^bsub>A\<^esub> x = f x
[PROOF STEP]
apply (simp add:compose_def ag_idmap_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma subtree_size_decr: "\<lbrakk>is_subtree t1 t2; t1 \<noteq> t2\<rbrakk> \<Longrightarrow> size t1 < size t2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_subtree t1 t2; t1 \<noteq> t2\<rbrakk> \<Longrightarrow> size t1 < size t2
[PROOF STEP]
using dtree_size_decr_aux
[PROOF STATE]
proof (prove)
using this:
(?x, ?y) \<in> fset ?xs \<Longrightarrow> size ?x < size (Node ?r ?xs)

goal (1 subgoal):
 1. \<lbrakk>is_subtree t1 t2; t1 \<noteq> t2\<rbrakk> \<Longrightarrow> size t1 < size t2
[PROOF STEP]
by(induction t2) fastforce


[STATEMENT]
lemma monoI1: "\<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> monoseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n \<Longrightarrow> monoseq X
[PROOF STEP]
by (simp add: monoseq_def)


[STATEMENT]
lemma complement_antitone:
  "x \<le> y \<Longrightarrow> -y \<le> -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> - y \<le> - x
[PROOF STEP]
by (metis le_iff_sup maddux_3_3 sba2_export sup_monoid.add_commute)


[STATEMENT]
lemma partial_heap_added_first_el:
  assumes
    "l \<le> m" "m \<le> r"
    "is_partial_heap cmp heap l (m + 1) r"
  shows "is_partial_heap_except_down cmp heap l m r m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_partial_heap_except_down cmp heap l m r m
[PROOF STEP]
unfolding is_partial_heap_except_down_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
let ?p_x = "parent l x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
let ?gp_x = "parent l ?p_x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
show "bounded m r x \<longrightarrow>
        (?p_x \<noteq> m \<longrightarrow> bounded m r ?p_x \<longrightarrow> cmp (heap ?p_x) (heap x)) \<and>
        (?p_x = m \<longrightarrow> bounded m r ?gp_x \<longrightarrow> cmp (heap ?gp_x) (heap x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
assume x_bound: "bounded m r x"
[PROOF STATE]
proof (state)
this:
bounded m r x

goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
have p_x_lower: "?p_x \<noteq> m \<longrightarrow> bounded m r ?p_x \<longrightarrow> ?p_x \<ge> m + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> parent l x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> parent l x

goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
hence "?p_x \<noteq> m \<longrightarrow> bounded m r ?p_x \<longrightarrow> x \<ge> m + 1"
[PROOF STATE]
proof (prove)
using this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> parent l x

goal (1 subgoal):
 1. parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> x
[PROOF STEP]
using parent_upper_bound[of l x] x_bound assms(1)
[PROOF STATE]
proof (prove)
using this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> parent l x
(parent l x < x) = (l \<le> x)
bounded m r x
l \<le> m

goal (1 subgoal):
 1. parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> x
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> x

goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
hence p_invariant: "(?p_x \<noteq> m \<longrightarrow> bounded m r ?p_x \<longrightarrow> cmp (heap ?p_x) (heap x))"
[PROOF STATE]
proof (prove)
using this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> x

goal (1 subgoal):
 1. parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)
[PROOF STEP]
using assms(3) is_partial_heap_def p_x_lower x_bound
[PROOF STATE]
proof (prove)
using this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> x
is_partial_heap cmp heap l (m + 1) r
is_partial_heap ?cmp ?heap ?l ?m ?r = (\<forall>x. bounded ?m ?r x \<longrightarrow> bounded ?m ?r (parent ?l x) \<longrightarrow> ?cmp (?heap (parent ?l x)) (?heap x))
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> m + 1 \<le> parent l x
bounded m r x

goal (1 subgoal):
 1. parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)

goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
have gp_up_bound: "(?p_x = m \<longrightarrow> ?gp_x < m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parent l x = m \<longrightarrow> parent l (parent l x) < m
[PROOF STEP]
by (simp add: assms(1) parent_upper_bound)
[PROOF STATE]
proof (state)
this:
parent l x = m \<longrightarrow> parent l (parent l x) < m

goal (1 subgoal):
 1. bounded m r x \<Longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
show "(?p_x \<noteq> m \<longrightarrow> bounded m r ?p_x \<longrightarrow> cmp (heap ?p_x) (heap x)) \<and>
          (?p_x = m \<longrightarrow> bounded m r ?gp_x \<longrightarrow> cmp (heap ?gp_x) (heap x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
using gp_up_bound p_invariant
[PROOF STATE]
proof (prove)
using this:
parent l x = m \<longrightarrow> parent l (parent l x) < m
parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)

goal (1 subgoal):
 1. (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bounded m r x \<longrightarrow> (parent l x \<noteq> m \<longrightarrow> bounded m r (parent l x) \<longrightarrow> cmp (heap (parent l x)) (heap x)) \<and> (parent l x = m \<longrightarrow> bounded m r (parent l (parent l x)) \<longrightarrow> cmp (heap (parent l (parent l x))) (heap x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graph_homomorphism_nonempty:
  assumes "graph_homomorphism A B f" ":A:\<lbrakk>e\<rbrakk> \<noteq> {}"
  shows ":B:\<lbrakk>e\<rbrakk> \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
graph_homomorphism A B f
:A:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
have g:"graph A"
[PROOF STATE]
proof (prove)
using this:
graph_homomorphism A B f
:A:\<lbrakk>e\<rbrakk> \<noteq> {}

goal (1 subgoal):
 1. graph A
[PROOF STEP]
unfolding graph_homomorphism_def
[PROOF STATE]
proof (prove)
using this:
vertices A = Domain f \<and> graph A \<and> graph B \<and> f `` vertices A \<subseteq> vertices B \<and> univalent f \<and> edge_preserving f (edges A) (edges B)
:A:\<lbrakk>e\<rbrakk> \<noteq> {}

goal (1 subgoal):
 1. graph A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
graph A

goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
graph_homomorphism A B f
:A:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
obtain a b where ab:"(a,b) \<in> :A:\<lbrakk>e\<rbrakk>"
[PROOF STATE]
proof (prove)
using this:
graph_homomorphism A B f
:A:\<lbrakk>e\<rbrakk> \<noteq> {}

goal (1 subgoal):
 1. (\<And>a b. (a, b) \<in> :A:\<lbrakk>e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a, b) \<in> :A:\<lbrakk>e\<rbrakk>

goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
from semantics_in_vertices[OF g ab]
[PROOF STATE]
proof (chain)
picking this:
a \<in> vertices A
b \<in> vertices A
[PROOF STEP]
obtain a' b' where
    "(a,a') \<in> f" "(b,b') \<in> f"
[PROOF STATE]
proof (prove)
using this:
a \<in> vertices A
b \<in> vertices A

goal (1 subgoal):
 1. (\<And>a' b'. \<lbrakk>(a, a') \<in> f; (b, b') \<in> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<in> vertices A
b \<in> vertices A
graph_homomorphism A B f

goal (1 subgoal):
 1. (\<And>a' b'. \<lbrakk>(a, a') \<in> f; (b, b') \<in> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding graph_homomorphism_def
[PROOF STATE]
proof (prove)
using this:
a \<in> vertices A
b \<in> vertices A
vertices A = Domain f \<and> graph A \<and> graph B \<and> f `` vertices A \<subseteq> vertices B \<and> univalent f \<and> edge_preserving f (edges A) (edges B)

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

goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
from graph_homomorphism_semantics[OF assms(1) ab this]
[PROOF STATE]
proof (chain)
picking this:
(a', b') \<in> :B:\<lbrakk>e\<rbrakk>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a', b') \<in> :B:\<lbrakk>e\<rbrakk>

goal (1 subgoal):
 1. :B:\<lbrakk>e\<rbrakk> \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
:B:\<lbrakk>e\<rbrakk> \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fid_onE[elim!]:
  assumes "x \<in>\<^sub>\<circ> fid_on A" and "\<exists>a\<in>\<^sub>\<circ>A. x = [a, a]\<^sub>\<circ> \<Longrightarrow> P"
  shows P
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> fid_on A
\<exists>a\<in>elts A. x = [a, a]\<^sub>\<circ> \<Longrightarrow> P

goal (1 subgoal):
 1. P
[PROOF STEP]
unfolding fid_on_def
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> set {[a, a]\<^sub>\<circ> |a. a \<in>\<^sub>\<circ> A}
\<exists>a\<in>elts A. x = [a, a]\<^sub>\<circ> \<Longrightarrow> P

goal (1 subgoal):
 1. P
[PROOF STEP]
by auto


[STATEMENT]
lemma vars_resultant_mpoly_poly: "vars (resultant_mpoly_poly x p q) \<subseteq> vars p - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (resultant_mpoly_poly x p q) \<subseteq> vars p - {x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
assume "y \<in> vars (resultant_mpoly_poly x p q)"
[PROOF STATE]
proof (state)
this:
y \<in> vars (resultant_mpoly_poly x p q)

goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
from set_mp[OF vars_resultant this[unfolded resultant_mpoly_poly_def]]
[PROOF STATE]
proof (chain)
picking this:
y \<in> \<Union> (vars ` (range (coeff (mpoly_to_mpoly_poly x p)) \<union> range (coeff (map_poly Const q))))
[PROOF STEP]
obtain i
    where "y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i)"
[PROOF STATE]
proof (prove)
using this:
y \<in> \<Union> (vars ` (range (coeff (mpoly_to_mpoly_poly x p)) \<union> range (coeff (map_poly Const q))))

goal (1 subgoal):
 1. (\<And>i. y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
have "vars (coeff (map_poly Const q) i) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (coeff (map_poly Const q) i) = {}
[PROOF STEP]
by (subst coeff_map_poly, auto)
[PROOF STATE]
proof (state)
this:
vars (coeff (map_poly Const q) i) = {}

goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i)
vars (coeff (map_poly Const q) i) = {}
[PROOF STEP]
have "y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i)"
[PROOF STATE]
proof (prove)
using this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i) \<or> y \<in> vars (coeff (map_poly Const q) i)
vars (coeff (map_poly Const q) i) = {}

goal (1 subgoal):
 1. y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> vars (resultant_mpoly_poly x p q) \<Longrightarrow> xa \<in> vars p - {x}
[PROOF STEP]
thus "y \<in> More_MPoly_Type.vars p - {x}"
[PROOF STATE]
proof (prove)
using this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i)

goal (1 subgoal):
 1. y \<in> vars p - {x}
[PROOF STEP]
using vars_coeff_mpoly_to_mpoly_poly
[PROOF STATE]
proof (prove)
using this:
y \<in> vars (coeff (mpoly_to_mpoly_poly x p) i)
vars (coeff (mpoly_to_mpoly_poly ?x ?p) ?i) \<subseteq> vars ?p - {?x}

goal (1 subgoal):
 1. y \<in> vars p - {x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<in> vars p - {x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma symmetric_mpoly_symmetric_prod':
  assumes "\<And>\<pi>. \<pi> permutes A \<Longrightarrow> g \<pi> permutes X"
  assumes "\<And>x \<pi>. x \<in> X \<Longrightarrow> \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (f x) = f (g \<pi> x)"
  shows "symmetric_mpoly A (\<Prod>x\<in>X. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symmetric_mpoly A (prod f X)
[PROOF STEP]
unfolding symmetric_mpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<pi>. \<pi> permutes A \<longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
fix \<pi>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
assume \<pi>: "\<pi> permutes A"
[PROOF STATE]
proof (state)
this:
\<pi> permutes A

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
have "mpoly_map_vars \<pi> (prod f X) = (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_map_vars \<pi> (prod f X) = (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (prod f X) = (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (prod f X) = (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>X. f (g \<pi> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Prod>x\<in>X. f (g \<pi> x))
[PROOF STEP]
by (intro prod.cong assms \<pi> refl)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Prod>x\<in>X. f (g \<pi> x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Prod>x\<in>X. f (g \<pi> x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
have "\<dots> = (\<Prod>x\<in>g \<pi>`X. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. f (g \<pi> x)) = prod f (g \<pi> ` X)
[PROOF STEP]
using assms(1)[OF \<pi>]
[PROOF STATE]
proof (prove)
using this:
g \<pi> permutes X

goal (1 subgoal):
 1. (\<Prod>x\<in>X. f (g \<pi> x)) = prod f (g \<pi> ` X)
[PROOF STEP]
by (subst prod.reindex) (auto simp: permutes_inj_on)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. f (g \<pi> x)) = prod f (g \<pi> ` X)

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. f (g \<pi> x)) = prod f (g \<pi> ` X)

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
have "g \<pi> ` X = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<pi> ` X = X
[PROOF STEP]
using assms(1)[OF \<pi>]
[PROOF STATE]
proof (prove)
using this:
g \<pi> permutes X

goal (1 subgoal):
 1. g \<pi> ` X = X
[PROOF STEP]
by (simp add: permutes_image)
[PROOF STATE]
proof (state)
this:
g \<pi> ` X = X

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
show "mpoly_map_vars \<pi> (prod f X) = prod f X"
[PROOF STATE]
proof (prove)
using this:
mpoly_map_vars \<pi> (prod f X) = prod f X

goal (1 subgoal):
 1. mpoly_map_vars \<pi> (prod f X) = prod f X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (prod f X) = prod f X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<psi>_altdef:
  assumes "x > 0"
  shows   "\<psi> x = sum_upto (\<lambda>m. prime_sum_upto ln (root m x)) (log 2 x)" (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
have finite: "finite {p. prime p \<and> real p \<le> y}" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {p. prime p \<and> real p \<le> y}
[PROOF STEP]
by (rule finite_subset[of _ "{..nat \<lfloor>y\<rfloor>}"]) (auto simp: le_nat_iff' le_floor_iff)
[PROOF STATE]
proof (state)
this:
finite {p. prime p \<and> real p \<le> ?y}

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
define S where "S = (SIGMA i:{i. 0 < i \<and> real i \<le> log 2 x}. {p. prime p \<and> real p \<le> root i x})"
[PROOF STATE]
proof (state)
this:
S = (SIGMA i:{i. 0 < i \<and> real i \<le> log 2 x}. {p. prime p \<and> real p \<le> root i x})

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
have "\<psi> x = (\<Sum>(p, i) | prime p \<and> 0 < i \<and> real (p ^ i) \<le> x. ln (real p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> x = (\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))
[PROOF STEP]
unfolding \<psi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto mangoldt x = (\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))
[PROOF STEP]
by (subst sum_upto_primepows[where g = "\<lambda>p i. ln (real p)"])
       (auto simp: case_prod_unfold mangoldt_non_primepow)
[PROOF STATE]
proof (state)
this:
\<psi> x = (\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<psi> x = (\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
have "\<dots> = (\<Sum>(i, p) | prime p \<and> 0 < i \<and> real (p ^ i) \<le> x. ln (real p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p)) = (\<Sum>(i, p)\<in>{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ "\<lambda>(x,y). (y,x)" "\<lambda>(x,y). (y,x)"]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p)) = (\<Sum>(i, p)\<in>{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(p, i)\<in>{(p, i). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p)) = (\<Sum>(i, p)\<in>{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x}. ln (real p))

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
have "{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x} = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x} = S
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x} = (SIGMA i:{i. 0 < i \<and> real i \<le> log 2 x}. {p. prime p \<and> real p \<le> root i x})
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
 3. \<And>a b. \<lbrakk>0 < a; real a \<le> log 2 x; prime b; real b \<le> root a x\<rbrakk> \<Longrightarrow> real (b ^ a) \<le> x
[PROOF STEP]
fix i p :: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
 3. \<And>a b. \<lbrakk>0 < a; real a \<le> log 2 x; prime b; real b \<le> root a x\<rbrakk> \<Longrightarrow> real (b ^ a) \<le> x
[PROOF STEP]
assume ip: "i > 0" "real i \<le> log 2 x" "prime p" "real p \<le> root i x"
[PROOF STATE]
proof (state)
this:
0 < i
real i \<le> log 2 x
prime p
real p \<le> root i x

goal (3 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
 3. \<And>a b. \<lbrakk>0 < a; real a \<le> log 2 x; prime b; real b \<le> root a x\<rbrakk> \<Longrightarrow> real (b ^ a) \<le> x
[PROOF STEP]
hence "real (p ^ i) \<le> root i x ^ i"
[PROOF STATE]
proof (prove)
using this:
0 < i
real i \<le> log 2 x
prime p
real p \<le> root i x

goal (1 subgoal):
 1. real (p ^ i) \<le> root i x ^ i
[PROOF STEP]
unfolding of_nat_power
[PROOF STATE]
proof (prove)
using this:
0 < i
real i \<le> log 2 x
prime p
real p \<le> root i x

goal (1 subgoal):
 1. real p ^ i \<le> root i x ^ i
[PROOF STEP]
by (intro power_mono) auto
[PROOF STATE]
proof (state)
this:
real (p ^ i) \<le> root i x ^ i

goal (3 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
 3. \<And>a b. \<lbrakk>0 < a; real a \<le> log 2 x; prime b; real b \<le> root a x\<rbrakk> \<Longrightarrow> real (b ^ a) \<le> x
[PROOF STEP]
with ip assms
[PROOF STATE]
proof (chain)
picking this:
0 < i
real i \<le> log 2 x
prime p
real p \<le> root i x
0 < x
real (p ^ i) \<le> root i x ^ i
[PROOF STEP]
show "real (p ^ i) \<le> x"
[PROOF STATE]
proof (prove)
using this:
0 < i
real i \<le> log 2 x
prime p
real p \<le> root i x
0 < x
real (p ^ i) \<le> root i x ^ i

goal (1 subgoal):
 1. real (p ^ i) \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (p ^ i) \<le> x

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
fix i p
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
assume ip: "prime p" "i > 0" "real (p ^ i) \<le> x"
[PROOF STATE]
proof (state)
this:
prime p
0 < i
real (p ^ i) \<le> x

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
from ip
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < i
real (p ^ i) \<le> x
[PROOF STEP]
have "2 ^ i \<le> p ^ i"
[PROOF STATE]
proof (prove)
using this:
prime p
0 < i
real (p ^ i) \<le> x

goal (1 subgoal):
 1. 2 ^ i \<le> p ^ i
[PROOF STEP]
by (intro power_mono) (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
2 ^ i \<le> p ^ i

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ i \<le> p ^ i

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
have "\<dots> \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (p ^ i) \<le> x
[PROOF STEP]
using ip
[PROOF STATE]
proof (prove)
using this:
prime p
0 < i
real (p ^ i) \<le> x

goal (1 subgoal):
 1. real (p ^ i) \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (p ^ i) \<le> x

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real a \<le> log 2 x
 2. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (2 ^ i) \<le> x
[PROOF STEP]
show "real i \<le> log 2 x"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (2 ^ i) \<le> x

goal (1 subgoal):
 1. real i \<le> log 2 x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> real x \<le> real y) \<Longrightarrow> real (2 ^ i) \<le> x
0 < x

goal (1 subgoal):
 1. real i \<le> log 2 x
[PROOF STEP]
by (simp add: le_log_iff powr_realpow)
[PROOF STATE]
proof (state)
this:
real i \<le> log 2 x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
have "root i (real p ^ i) \<le> root i x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root i (real p ^ i) \<le> root i x
[PROOF STEP]
using ip assms
[PROOF STATE]
proof (prove)
using this:
prime p
0 < i
real (p ^ i) \<le> x
0 < x

goal (1 subgoal):
 1. root i (real p ^ i) \<le> root i x
[PROOF STEP]
by (subst real_root_le_iff) auto
[PROOF STATE]
proof (state)
this:
root i (real p ^ i) \<le> root i x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
root i (real p ^ i) \<le> root i x

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
have "root i (real p ^ i) = real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root i (real p ^ i) = real p
[PROOF STEP]
using assms ip
[PROOF STATE]
proof (prove)
using this:
0 < x
prime p
0 < i
real (p ^ i) \<le> x

goal (1 subgoal):
 1. root i (real p ^ i) = real p
[PROOF STEP]
by (subst real_root_pos2) auto
[PROOF STATE]
proof (state)
this:
root i (real p ^ i) = real p

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>prime b; 0 < a; real (b ^ a) \<le> x\<rbrakk> \<Longrightarrow> real b \<le> root a x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real p \<le> root i x
[PROOF STEP]
show "real p \<le> root i x"
[PROOF STATE]
proof (prove)
using this:
real p \<le> root i x

goal (1 subgoal):
 1. real p \<le> root i x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real p \<le> root i x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x} = S

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{(i, p). prime p \<and> 0 < i \<and> real (p ^ i) \<le> x} = S

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
have "(\<Sum>(i,p)\<in>S. ln p) = sum_upto (\<lambda>m. prime_sum_upto ln (root m x)) (log 2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, p)\<in>S. ln (real p)) = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
unfolding sum_upto_def prime_sum_upto_def S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, p)\<in>(SIGMA i:{i. 0 < i \<and> real i \<le> log 2 x}. {p. prime p \<and> real p \<le> root i x}). ln (real p)) = (\<Sum>m\<in>{i. 0 < i \<and> real i \<le> log 2 x}. \<Sum>x\<in>{p. prime p \<and> real p \<le> root m x}. ln (real x))
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
finite {p. prime p \<and> real p \<le> ?y}

goal (1 subgoal):
 1. (\<Sum>(i, p)\<in>(SIGMA i:{i. 0 < i \<and> real i \<le> log 2 x}. {p. prime p \<and> real p \<le> root i x}). ln (real p)) = (\<Sum>m\<in>{i. 0 < i \<and> real i \<le> log 2 x}. \<Sum>x\<in>{p. prime p \<and> real p \<le> root m x}. ln (real x))
[PROOF STEP]
by (subst sum.Sigma) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, p)\<in>S. ln (real p)) = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)

goal (1 subgoal):
 1. \<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<psi> x = sum_upto (\<lambda>m. prime_sum_upto (\<lambda>x. ln (real x)) (root m x)) (log 2 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ord_Least:
  assumes "Ord k" "P k"
  shows "Ord (LEAST i. Ord i \<and> P i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> P i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> P i)
[PROOF STEP]
have "Ord (LEAST i. Ord i \<and> (Ord i \<and> P i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> Ord i \<and> P i)
[PROOF STEP]
using Ord_LeastI [where P = "\<lambda>i. Ord i \<and> P i"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Ord ?k; Ord ?k \<and> P ?k\<rbrakk> \<Longrightarrow> Ord (LEAST i. Ord i \<and> Ord i \<and> P i) \<and> P (LEAST i. Ord i \<and> Ord i \<and> P i)
Ord k
P k

goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> Ord i \<and> P i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Ord (LEAST i. Ord i \<and> Ord i \<and> P i)

goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> P i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ord (LEAST i. Ord i \<and> Ord i \<and> P i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ord (LEAST i. Ord i \<and> Ord i \<and> P i)

goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> P i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Ord (LEAST i. Ord i \<and> P i)

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>The following 3 lemmas are due to Brian Huffman\<close>


[STATEMENT]
lemma ord_of_inject [iff]: "ord_of i = ord_of j \<longleftrightarrow> i=j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord_of i = ord_of j) = (i = j)
[PROOF STEP]
proof (induct i arbitrary: j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>j. (ord_of 0 = ord_of j) = (0 = j)
 2. \<And>i j. (\<And>j. (ord_of i = ord_of j) = (i = j)) \<Longrightarrow> (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>j. (ord_of 0 = ord_of j) = (0 = j)
 2. \<And>i j. (\<And>j. (ord_of i = ord_of j) = (i = j)) \<Longrightarrow> (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord_of 0 = ord_of j) = (0 = j)
[PROOF STEP]
by (metis Zero_neq_Suc hempty_iff hmem_succ_self ord_of.elims)
[PROOF STATE]
proof (state)
this:
(ord_of 0 = ord_of j) = (0 = j)

goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of i = ord_of j) = (i = j)) \<Longrightarrow> (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of i = ord_of j) = (i = j)) \<Longrightarrow> (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
case (Suc i)
[PROOF STATE]
proof (state)
this:
(ord_of i = ord_of ?j) = (i = ?j)

goal (1 subgoal):
 1. \<And>i j. (\<And>j. (ord_of i = ord_of j) = (i = j)) \<Longrightarrow> (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ord_of (Suc i) = ord_of j) = (Suc i = j)
[PROOF STEP]
by (cases j) (auto simp: Suc)
[PROOF STATE]
proof (state)
this:
(ord_of (Suc i) = ord_of j) = (Suc i = j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tabulate_toList[simp, code abstract]:
  "toList (tabulate ks f) = List.map (\<lambda>k. (k, f k)) (toList ks)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. toList (tabulate ks f) = map (\<lambda>k. (k, f k)) (toList ks)
[PROOF STEP]
unfolding tabulate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. toList (ODList (map (\<lambda>k. (k, f k)) (toList ks))) = map (\<lambda>k. (k, f k)) (toList ks)
[PROOF STEP]
apply (simp add: toList_ODList)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msort (map (\<lambda>k. (k, f k)) (toList ks)) = map (\<lambda>k. (k, f k)) (toList ks)
[PROOF STEP]
apply (subst msort_map)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. distinct (toList ks)
 2. sorted (toList ks)
 3. inj_on (\<lambda>k. (k, f k)) (set (toList ks))
 4. order_class.mono_on (\<lambda>k. (k, f k)) (set (toList ks))
 5. map (\<lambda>k. (k, f k)) (toList ks) = map (\<lambda>k. (k, f k)) (toList ks)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on (\<lambda>k. (k, f k)) (set (toList ks))
 2. order_class.mono_on (\<lambda>k. (k, f k)) (set (toList ks))
[PROOF STEP]
apply (rule inj_onI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> set (toList ks); y \<in> set (toList ks); (x, f x) = (y, f y)\<rbrakk> \<Longrightarrow> x = y
 2. order_class.mono_on (\<lambda>k. (k, f k)) (set (toList ks))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order_class.mono_on (\<lambda>k. (k, f k)) (set (toList ks))
[PROOF STEP]
apply (rule mono_onI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set (toList ks); y \<in> set (toList ks); x \<le> y\<rbrakk> \<Longrightarrow> (x, f x) \<le> (y, f y)
[PROOF STEP]
apply (simp add: less_eq_prod_def less_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_imp_le_inf_prefix: "\<lbrakk> prefix x y; prefix x z \<rbrakk> \<Longrightarrow> prefix x (y \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prefix x y; prefix x z\<rbrakk> \<Longrightarrow> prefix x (y \<sqinter> z)
[PROOF STEP]
by (rule le_inf_prefix_iff[THEN iffD2], simp)


[STATEMENT]
lemma sin_converges: "(\<lambda>n. sin_coeff n *\<^sub>R x^n) sums sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sin_coeff n *\<^sub>R x ^ n) sums sin x
[PROOF STEP]
unfolding sin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sin_coeff n *\<^sub>R x ^ n) sums (\<Sum>n. sin_coeff n *\<^sub>R x ^ n)
[PROOF STEP]
by (metis (full_types) summable_norm_cancel summable_norm_sin summable_sums)


[STATEMENT]
lemma count_pre_surj:
  assumes "countable B"
  and "w \<in> Y -`B"
shows "\<exists>i. w \<in> (countable_preimages B Y) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
proof (cases "finite B")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
 2. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite B

goal (2 subgoals):
 1. finite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
 2. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
have "\<exists> i < card B. (from_nat_into B) i = Y w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<card B. from_nat_into B i = Y w
[PROOF STEP]
by (metis True assms(1) assms(2) bij_betw_def from_nat_into_to_nat_on image_eqI lessThan_iff
          to_nat_on_finite vimageE)
[PROOF STATE]
proof (state)
this:
\<exists>i<card B. from_nat_into B i = Y w

goal (2 subgoals):
 1. finite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
 2. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>i<card B. from_nat_into B i = Y w
[PROOF STEP]
obtain i where "i< card B" and "(from_nat_into B) i = Y w"
[PROOF STATE]
proof (prove)
using this:
\<exists>i<card B. from_nat_into B i = Y w

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < card B; from_nat_into B i = Y w\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i < card B
from_nat_into B i = Y w

goal (2 subgoals):
 1. finite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
 2. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
hence "w \<in> (countable_preimages B Y) i"
[PROOF STATE]
proof (prove)
using this:
i < card B
from_nat_into B i = Y w

goal (1 subgoal):
 1. w \<in> countable_preimages B Y i
[PROOF STEP]
by (simp add: countable_preimages_def)
[PROOF STATE]
proof (state)
this:
w \<in> countable_preimages B Y i

goal (2 subgoals):
 1. finite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
 2. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
thus "\<exists>i. w \<in> (countable_preimages B Y) i"
[PROOF STATE]
proof (prove)
using this:
w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>i. w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite B

goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
hence "\<exists> i. (from_nat_into B) i = Y w"
[PROOF STATE]
proof (prove)
using this:
infinite B

goal (1 subgoal):
 1. \<exists>i. from_nat_into B i = Y w
[PROOF STEP]
by (meson assms(1) assms(2) from_nat_into_to_nat_on vimageE)
[PROOF STATE]
proof (state)
this:
\<exists>i. from_nat_into B i = Y w

goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. from_nat_into B i = Y w
[PROOF STEP]
obtain i where  "(from_nat_into B) i = Y w"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. from_nat_into B i = Y w

goal (1 subgoal):
 1. (\<And>i. from_nat_into B i = Y w \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
from_nat_into B i = Y w

goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
hence "w \<in> (countable_preimages B Y) i"
[PROOF STATE]
proof (prove)
using this:
from_nat_into B i = Y w

goal (1 subgoal):
 1. w \<in> countable_preimages B Y i
[PROOF STEP]
by (simp add: False countable_preimages_def)
[PROOF STATE]
proof (state)
this:
w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. infinite B \<Longrightarrow> \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
thus "\<exists>i. w \<in> (countable_preimages B Y) i"
[PROOF STATE]
proof (prove)
using this:
w \<in> countable_preimages B Y i

goal (1 subgoal):
 1. \<exists>i. w \<in> countable_preimages B Y i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>i. w \<in> countable_preimages B Y i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem is_inf_uniq: "is_inf x y i \<Longrightarrow> is_inf x y i' \<Longrightarrow> i = i'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_inf x y i; is_inf x y i'\<rbrakk> \<Longrightarrow> i = i'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_inf x y i; is_inf x y i'\<rbrakk> \<Longrightarrow> i = i'
[PROOF STEP]
assume inf: "is_inf x y i"
[PROOF STATE]
proof (state)
this:
is_inf x y i

goal (1 subgoal):
 1. \<lbrakk>is_inf x y i; is_inf x y i'\<rbrakk> \<Longrightarrow> i = i'
[PROOF STEP]
assume inf': "is_inf x y i'"
[PROOF STATE]
proof (state)
this:
is_inf x y i'

goal (1 subgoal):
 1. \<lbrakk>is_inf x y i; is_inf x y i'\<rbrakk> \<Longrightarrow> i = i'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = i'
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<sqsubseteq> i'
 2. i' \<sqsubseteq> i
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i'
[PROOF STEP]
show "i \<sqsubseteq> i'"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i'

goal (1 subgoal):
 1. i \<sqsubseteq> i'
[PROOF STEP]
proof (rule is_inf_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<sqsubseteq> x
 2. i \<sqsubseteq> y
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i
[PROOF STEP]
show "i \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i

goal (1 subgoal):
 1. i \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
i \<sqsubseteq> x

goal (1 subgoal):
 1. i \<sqsubseteq> y
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i
[PROOF STEP]
show "i \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i

goal (1 subgoal):
 1. i \<sqsubseteq> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
i \<sqsubseteq> y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i \<sqsubseteq> i'

goal (1 subgoal):
 1. i' \<sqsubseteq> i
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i
[PROOF STEP]
show "i' \<sqsubseteq> i"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i

goal (1 subgoal):
 1. i' \<sqsubseteq> i
[PROOF STEP]
proof (rule is_inf_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i' \<sqsubseteq> x
 2. i' \<sqsubseteq> y
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i'
[PROOF STEP]
show "i' \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i'

goal (1 subgoal):
 1. i' \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
i' \<sqsubseteq> x

goal (1 subgoal):
 1. i' \<sqsubseteq> y
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y i'
[PROOF STEP]
show "i' \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
is_inf x y i'

goal (1 subgoal):
 1. i' \<sqsubseteq> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
i' \<sqsubseteq> y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i' \<sqsubseteq> i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i = i'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_closed : "g \<in> G \<Longrightarrow> -g \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> G \<Longrightarrow> - g \<in> G
[PROOF STEP]
using zero_closed diff_closed[of 0 g]
[PROOF STATE]
proof (prove)
using this:
(0::'g) \<in> G
\<lbrakk>(0::'g) \<in> G; g \<in> G\<rbrakk> \<Longrightarrow> (0::'g) - g \<in> G

goal (1 subgoal):
 1. g \<in> G \<Longrightarrow> - g \<in> G
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_linear_image:
  assumes "bounded S"
    and "bounded_linear f"
  shows "bounded (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (f ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded (f ` S)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
bounded S
[PROOF STEP]
obtain b where "b > 0" and b: "\<forall>x\<in>S. norm x \<le> b"
[PROOF STATE]
proof (prove)
using this:
bounded S

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>0 < b; \<forall>x\<in>S. norm x \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bounded_pos
[PROOF STATE]
proof (prove)
using this:
\<exists>b>0. \<forall>x\<in>S. norm x \<le> b

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>0 < b; \<forall>x\<in>S. norm x \<le> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < b
\<forall>x\<in>S. norm x \<le> b

goal (1 subgoal):
 1. bounded (f ` S)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
bounded_linear f
[PROOF STEP]
obtain B where B: "B > 0" "\<forall>x. norm (f x) \<le> B * norm x"
[PROOF STATE]
proof (prove)
using this:
bounded_linear f

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>x. norm (f x) \<le> B * norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bounded_linear.pos_bounded
[PROOF STATE]
proof (prove)
using this:
bounded_linear f
bounded_linear ?f \<Longrightarrow> \<exists>K>0. \<forall>x. norm (?f x) \<le> norm x * K

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>x. norm (f x) \<le> B * norm x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: ac_simps)
[PROOF STATE]
proof (state)
this:
0 < B
\<forall>x. norm (f x) \<le> B * norm x

goal (1 subgoal):
 1. bounded (f ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (f ` S)
[PROOF STEP]
unfolding bounded_pos
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b>0. \<forall>x\<in>f ` S. norm x \<le> b
[PROOF STEP]
proof (intro exI, safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?b
 2. \<And>x xa. xa \<in> S \<Longrightarrow> norm (f xa) \<le> ?b
[PROOF STEP]
show "norm (f x) \<le> B * b" if "x \<in> S" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f x) \<le> B * b
[PROOF STEP]
by (meson B b less_imp_le mult_left_mono order_trans that)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> norm (f ?x) \<le> B * b

goal (1 subgoal):
 1. 0 < B * b
[PROOF STEP]
qed (use \<open>b > 0\<close> \<open>B > 0\<close> in auto)
[PROOF STATE]
proof (state)
this:
bounded (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HFinite_FreeUltrafilterNat:
  assumes "star_n X \<in> HFinite"
  shows "\<exists>u. eventually (\<lambda>n. norm (X n) < u) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u
[PROOF STEP]
obtain r where "hnorm (star_n X) < hypreal_of_real r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. hnorm (star_n X) < hypreal_of_real r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using HFiniteD SReal_iff assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> HFinite \<Longrightarrow> \<exists>t\<in>\<real>. hnorm ?x < t
(?x \<in> \<real>) = (\<exists>y. ?x = hypreal_of_real y)
star_n X \<in> HFinite

goal (1 subgoal):
 1. (\<And>r. hnorm (star_n X) < hypreal_of_real r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
hnorm (star_n X) < hypreal_of_real r

goal (1 subgoal):
 1. \<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hnorm (star_n X) < hypreal_of_real r
[PROOF STEP]
have "\<forall>\<^sub>F n in \<U>. norm (X n) < r"
[PROOF STATE]
proof (prove)
using this:
hnorm (star_n X) < hypreal_of_real r

goal (1 subgoal):
 1. \<forall>\<^sub>F n in \<U>. norm (X n) < r
[PROOF STEP]
by (simp add: hnorm_def star_n_less star_of_def starfun_star_n)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in \<U>. norm (X n) < r

goal (1 subgoal):
 1. \<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in \<U>. norm (X n) < r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in \<U>. norm (X n) < r

goal (1 subgoal):
 1. \<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>u. \<forall>\<^sub>F n in \<U>. norm (X n) < u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma keys_lower: "keys (lower p v) = {u\<in>keys p. u \<prec>\<^sub>t v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (lower p v) = {u \<in> keys p. u \<prec>\<^sub>t v}
[PROOF STEP]
by (rule set_eqI, simp only: in_keys_iff, simp add: lookup_lower)


[STATEMENT]
lemma transpose_infmatrix_twice[simp]: "transpose_infmatrix (transpose_infmatrix A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_infmatrix (transpose_infmatrix A) = A
[PROOF STEP]
by ((rule ext)+, simp)