[STATEMENT]
lemma open_segment_Im_equal:
  assumes "Re x \<noteq> Re y" "Im x=Im y"
  shows "open_segment x y = {z. Im z = Im x
                                  \<and> Re z \<in> open_segment (Re x) (Re y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
have "open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
unfolding open_segment_image_interval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x = y then {} else (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}) = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re x \<noteq> Re y
Im x = Im y

goal (1 subgoal):
 1. (if x = y then {} else (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}) = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
open_segment x y = (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
have "... = (\<lambda>u. Complex (Re x + u * (Re y - Re x))
                      (Im y)) ` {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1}
[PROOF STEP]
apply (subst (1 2 3 4) complex_surj[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re (Complex (Re ((1 - u) *\<^sub>R Complex (Re x) (Im x))) (Im ((1 - u) *\<^sub>R Complex (Re x) (Im x))) + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y)))) (Im ((1 - u) *\<^sub>R x + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y))))) ` {0<..<1} = (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re x \<noteq> Re y
Im x = Im y

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re (Complex (Re ((1 - u) *\<^sub>R Complex (Re x) (Im x))) (Im ((1 - u) *\<^sub>R Complex (Re x) (Im x))) + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y)))) (Im ((1 - u) *\<^sub>R x + Complex (Re (u *\<^sub>R y)) (Im (u *\<^sub>R y))))) ` {0<..<1} = (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1}
[PROOF STEP]
by (simp add:scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>u. (1 - u) *\<^sub>R x + u *\<^sub>R y) ` {0<..<1} = (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
have "... = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
have "Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)"
      if "Re x \<noteq> Re y" "Im x = Im y"  "0 < u" "u < 1" for u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
[PROOF STEP]
define yx where "yx = Re y - Re x"
[PROOF STATE]
proof (state)
this:
yx = Re y - Re x

goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
[PROOF STEP]
have "Re y = yx + Re x" "yx >0 \<or> yx<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re y = yx + Re x &&& 0 < yx \<or> yx < 0
[PROOF STEP]
unfolding yx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re y = Re y - Re x + Re x &&& 0 < Re y - Re x \<or> Re y - Re x < 0
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Re x \<noteq> Re y
Im x = Im y
0 < u
u < 1

goal (1 subgoal):
 1. Re y = Re y - Re x + Re x &&& 0 < Re y - Re x \<or> Re y - Re x < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re y = yx + Re x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re y = yx + Re x
0 < yx \<or> yx < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Re y = yx + Re x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Re y = yx + Re x
0 < yx \<or> yx < 0

goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> (if Re x \<le> Re y then {Re x<..<Re y} else {Re y<..<Re x})
[PROOF STEP]
using that mult_pos_neg
[PROOF STATE]
proof (prove)
using this:
Re y = yx + Re x
0 < yx \<or> yx < 0
Re x \<noteq> Re y
Im x = Im y
0 < u
u < 1
\<lbrakk>(0::?'a) < ?a; ?b < (0::?'a)\<rbrakk> \<Longrightarrow> ?a * ?b < (0::?'a)

goal (1 subgoal):
 1. Re x + u * (Re y - Re x) \<in> (if Re x \<le> Re y then {Re x<..<Re y} else {Re y<..<Re x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Re x + u * (Re y - Re x) \<in> open_segment (Re x) (Re y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re x \<noteq> Re y; Im x = Im y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Re x + ?u * (Re y - Re x) \<in> open_segment (Re x) (Re y)

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>Re x \<noteq> Re y; Im x = Im y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Re x + ?u * (Re y - Re x) \<in> open_segment (Re x) (Re y)

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
have "z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y -  Re x)) (Im y))
                          ` {0<..<1}"
      if "Im x = Im y" "Im z = Im y" "Re z \<in> open_segment (Re x) (Re y)" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y - Re x)) (Im y)) ` {0<..<1}
[PROOF STEP]
apply (rule rev_image_eqI[of "(Re z - Re x)/(Re y - Re x)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (Re z - Re x) / (Re y - Re x) \<in> {0<..<1}
 2. z = Complex (Re x + (Re z - Re x) / (Re y - Re x) * (Re y - Re x)) (Im y)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re z - Re x) / (Re y - Re x) \<in> {0<..<1}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
Im x = Im y
Im z = Im y
Re z \<in> open_segment (Re x) (Re y)

goal (1 subgoal):
 1. (Re z - Re x) / (Re y - Re x) \<in> {0<..<1}
[PROOF STEP]
unfolding open_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
using this:
Im x = Im y
Im z = Im y
Re z \<in> (if Re x \<le> Re y then {Re x<..<Re y} else {Re y<..<Re x})

goal (1 subgoal):
 1. (Re z - Re x) / (Re y - Re x) \<in> {0<..<1}
[PROOF STEP]
by (auto simp:divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = Complex (Re x + (Re z - Re x) / (Re y - Re x) * (Re y - Re x)) (Im y)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = Complex (Re x + (Re z - Re x) / (Re y - Re x) * (Re y - Re x)) (Im y)
[PROOF STEP]
using \<open>Re x \<noteq> Re y\<close> complex_eq_iff that(2)
[PROOF STATE]
proof (prove)
using this:
Re x \<noteq> Re y
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)
Im z = Im y

goal (1 subgoal):
 1. z = Complex (Re x + (Re z - Re x) / (Re y - Re x) * (Re y - Re x)) (Im y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<lbrakk>Im x = Im y; Im ?z = Im y; Re ?z \<in> open_segment (Re x) (Re y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y - Re x)) (Im y)) ` {0<..<1}

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Re x \<noteq> Re y; Im x = Im y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Re x + ?u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
\<lbrakk>Im x = Im y; Im ?z = Im y; Re ?z \<in> open_segment (Re x) (Re y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y - Re x)) (Im y)) ` {0<..<1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Re x \<noteq> Re y; Im x = Im y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Re x + ?u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
\<lbrakk>Im x = Im y; Im ?z = Im y; Re ?z \<in> open_segment (Re x) (Re y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y - Re x)) (Im y)) ` {0<..<1}

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Re x \<noteq> Re y; Im x = Im y; 0 < ?u; ?u < 1\<rbrakk> \<Longrightarrow> Re x + ?u * (Re y - Re x) \<in> open_segment (Re x) (Re y)
\<lbrakk>Im x = Im y; Im ?z = Im y; Re ?z \<in> open_segment (Re x) (Re y)\<rbrakk> \<Longrightarrow> ?z \<in> (\<lambda>xa. Complex (Re x + xa * (Re y - Re x)) (Im y)) ` {0<..<1}
Re x \<noteq> Re y
Im x = Im y

goal (1 subgoal):
 1. (\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>u. Complex (Re x + u * (Re y - Re x)) (Im y)) ` {0<..<1} = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}

goal (1 subgoal):
 1. open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
open_segment x y = {z. Im z = Im x \<and> Re z \<in> open_segment (Re x) (Re y)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sign_compose: "permutation p \<Longrightarrow> permutation q \<Longrightarrow> sign (p \<circ> q) = sign p * sign q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>permutation p; permutation q\<rbrakk> \<Longrightarrow> sign (p \<circ> q) = sign p * sign q
[PROOF STEP]
by (simp add: sign_def evenperm_comp)


[STATEMENT]
lemma lift_mat_elems: "elements_mat (lift_01_mat M) \<subseteq> {0, 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
have "elements_mat (lift_01_mat M) = of_zero_neq_one ` (elements_mat M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elements_mat (lift_01_mat M) = of_zero_neq_one ` elements_mat M
[PROOF STEP]
by (simp add: lift_01_mat_def map_mat_elements)
[PROOF STATE]
proof (state)
this:
elements_mat (lift_01_mat M) = of_zero_neq_one ` elements_mat M

goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elements_mat (lift_01_mat M) = of_zero_neq_one ` elements_mat M
[PROOF STEP]
have "elements_mat (lift_01_mat M) \<subseteq> of_zero_neq_one ` {0, 1}"
[PROOF STATE]
proof (prove)
using this:
elements_mat (lift_01_mat M) = of_zero_neq_one ` elements_mat M

goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> of_zero_neq_one ` {0::'d, 1::'d}
[PROOF STEP]
using elems01
[PROOF STATE]
proof (prove)
using this:
elements_mat (lift_01_mat M) = of_zero_neq_one ` elements_mat M
elements_mat M \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> of_zero_neq_one ` {0::'d, 1::'d}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
elements_mat (lift_01_mat M) \<subseteq> of_zero_neq_one ` {0::?'d2, 1::?'d2}

goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
elements_mat (lift_01_mat M) \<subseteq> of_zero_neq_one ` {0::?'d2, 1::?'d2}

goal (1 subgoal):
 1. elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
elements_mat (lift_01_mat M) \<subseteq> {0::'a, 1::'a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uniform_limitI:
  "(\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < e) \<Longrightarrow> uniform_limit S f l F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. 0 < e \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < e) \<Longrightarrow> uniform_limit S f l F
[PROOF STEP]
by (simp add: uniform_limit_iff)


[STATEMENT]
lemma word_rsplit_0:
  "word_rsplit (0 :: machine_word) = replicate (word_bits div 8) (0 :: 8 word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_rsplit 0 = replicate (word_bits div 8) 0
[PROOF STEP]
by (simp add: word_rsplit_def bin_rsplit_def word_bits_def word_size_def Cons_replicate_eq)


[STATEMENT]
lemma (in partition) disjoint_sum: \<^marker>\<open>contributor \<open>Paulo Em?lio de Vilhena\<close>\<close>
  assumes "finite A"
  shows "(\<Sum>b\<in>B. \<Sum>a\<in>b. f a) = (\<Sum>a\<in>A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sum f) B = sum f A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (sum f) B = sum f A
[PROOF STEP]
have "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B
[PROOF STEP]
by (simp add: assms finite_UnionD partition_coverture)
[PROOF STATE]
proof (state)
this:
finite B

goal (1 subgoal):
 1. sum (sum f) B = sum f A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. sum (sum f) B = sum f A
[PROOF STEP]
using disjoint_sum assms partition_axioms
[PROOF STATE]
proof (prove)
using this:
finite B
\<lbrakk>finite ?B; finite ?A; Congruence.partition ?A ?B\<rbrakk> \<Longrightarrow> sum (sum ?f) ?B = sum ?f ?A
finite A
Congruence.partition A B

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jonsson2a: "(\<exists>g. \<forall>x y. x \<lhd> y = x\<cdot>g(y)) \<longleftrightarrow> (\<forall>x y. x \<lhd> y = x\<cdot>(1 \<lhd> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>g. \<forall>x y. x \<lhd> y = x \<cdot> g y) = (\<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y))
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>g. \<forall>x y. x \<lhd> y = x \<cdot> g y \<Longrightarrow> \<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y)
 2. \<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y) \<Longrightarrow> \<exists>g. \<forall>x y. x \<lhd> y = x \<cdot> g y
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y) \<Longrightarrow> \<exists>g. \<forall>x y. x \<lhd> y = x \<cdot> g y
[PROOF STEP]
apply (rule_tac x="\<lambda>x. 1 \<lhd> x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y) \<Longrightarrow> \<forall>x y. x \<lhd> y = x \<cdot> ((1::'a) \<lhd> y)
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eventually_lt_imp_eventually_le:
  "eventually (\<lambda>x. f x < (g x :: real)) F \<Longrightarrow> eventually (\<lambda>x. f x \<le> g x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x < g x \<Longrightarrow> \<forall>\<^sub>F x in F. f x \<le> g x
[PROOF STEP]
by (erule eventually_mono) simp


[STATEMENT]
lemma fds_nth_Suc_0_exp [simp]: "fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
have "(\<Sum>k. 0 ^ k /\<^sub>R fact k) = (\<Sum>k\<in>{0}. 0 ^ k /\<^sub>R fact k :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k\<in>{0}. (0::'a) ^ k /\<^sub>R fact k)
[PROOF STEP]
by (intro suminf_finite) (auto simp: power_0_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k\<in>{0}. (0::'a) ^ k /\<^sub>R fact k)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (\<Sum>k\<in>{0}. (0::'a) ^ k /\<^sub>R fact k)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{0}. (0::'a) ^ k /\<^sub>R fact k) = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{0}. (0::'a) ^ k /\<^sub>R fact k) = (1::'a)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k. (0::'a) ^ k /\<^sub>R fact k) = (1::'a)

goal (1 subgoal):
 1. fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))
[PROOF STEP]
by (simp add: fds_exp_def)
[PROOF STATE]
proof (state)
this:
fds_nth (fds_exp f) (Suc 0) = exp (fds_nth f (Suc 0))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma expectation_pair_pmf_fst [simp]:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  shows "measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
have "measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) =
          measure_pmf.expectation (map_pmf fst (pair_pmf p q)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation (map_pmf fst (pair_pmf p q)) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation (map_pmf fst (pair_pmf p q)) f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation (map_pmf fst (pair_pmf p q)) f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
have "map_pmf fst (pair_pmf p q) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf fst (pair_pmf p q) = p
[PROOF STEP]
by (simp add: map_fst_pair_pmf)
[PROOF STATE]
proof (state)
this:
map_pmf fst (pair_pmf p q) = p

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f

goal (1 subgoal):
 1. measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (pair_pmf p q) (\<lambda>x. f (fst x)) = measure_pmf.expectation p f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invertible_matrix_is_change_of_basis:
  assumes invertible_P: "invertible P" and basis_X: "is_basis (set_of_vector X)"
  shows "\<exists>!Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
 2. \<And>Y y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X; matrix_change_of_basis y X = matrix_change_of_basis Y X; is_basis (set_of_vector y)\<rbrakk> \<Longrightarrow> Y = y
[PROOF STEP]
show "\<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
obtain f where P: "P = matrix' X X f" and linear_f: "linear ((*s)) ((*s)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>P = matrix' X X f; linear (*s) (*s) f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using exists_linear_eq_matrix'[OF basis_X basis_X, of P]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. matrix' X X f = P \<and> linear (*s) (*s) f

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>P = matrix' X X f; linear (*s) (*s) f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P = matrix' X X f
linear (*s) (*s) f

goal (1 subgoal):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)
[PROOF STEP]
proof (rule exI[of _ "\<chi> j. f (X$j)"], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. matrix_change_of_basis (\<chi>j. f (X $ j)) X = P
 2. is_basis (set_of_vector (\<chi>j. f (X $ j)))
[PROOF STEP]
show "matrix_change_of_basis (\<chi> j. f (X $ j)) X = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_change_of_basis (\<chi>j. f (X $ j)) X = P
[PROOF STEP]
unfolding matrix_change_of_basis_def P matrix'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. coord X ((\<chi>j. f (X $ j)) $ j) $ i) = (\<chi>i j. coord X (f (X $ j)) $ i)
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
matrix_change_of_basis (\<chi>j. f (X $ j)) X = P

goal (1 subgoal):
 1. is_basis (set_of_vector (\<chi>j. f (X $ j)))
[PROOF STEP]
have invertible_f: "invertible_lf ((*s)) ((*s)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_lf (*s) (*s) f
[PROOF STEP]
using invertible_matrix'_imp_invertible_lf[OF _ basis_X linear_f basis_X]
[PROOF STATE]
proof (prove)
using this:
invertible (matrix' X X f) \<Longrightarrow> invertible_lf (*s) (*s) f

goal (1 subgoal):
 1. invertible_lf (*s) (*s) f
[PROOF STEP]
using invertible_P
[PROOF STATE]
proof (prove)
using this:
invertible (matrix' X X f) \<Longrightarrow> invertible_lf (*s) (*s) f
invertible P

goal (1 subgoal):
 1. invertible_lf (*s) (*s) f
[PROOF STEP]
unfolding P
[PROOF STATE]
proof (prove)
using this:
invertible (matrix' X X f) \<Longrightarrow> invertible_lf (*s) (*s) f
invertible (matrix' X X f)

goal (1 subgoal):
 1. invertible_lf (*s) (*s) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
invertible_lf (*s) (*s) f

goal (1 subgoal):
 1. is_basis (set_of_vector (\<chi>j. f (X $ j)))
[PROOF STEP]
have rw: "set_of_vector (\<chi> j. f (X $ j)) = f`(set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_vector (\<chi>j. f (X $ j)) = f ` set_of_vector X
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(\<chi>j. f (X $ j)) $ i |i. i \<in> UNIV} = f ` {X $ i |i. i \<in> UNIV}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_of_vector (\<chi>j. f (X $ j)) = f ` set_of_vector X

goal (1 subgoal):
 1. is_basis (set_of_vector (\<chi>j. f (X $ j)))
[PROOF STEP]
show "is_basis (set_of_vector (\<chi> j. f (X $ j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_basis (set_of_vector (\<chi>j. f (X $ j)))
[PROOF STEP]
unfolding rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_basis (f ` set_of_vector X)
[PROOF STEP]
using basis_image_linear[OF invertible_f basis_X]
[PROOF STATE]
proof (prove)
using this:
is_basis (f ` set_of_vector X)

goal (1 subgoal):
 1. is_basis (f ` set_of_vector X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector (\<chi>j. f (X $ j)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>Y. matrix_change_of_basis Y X = P \<and> is_basis (set_of_vector Y)

goal (1 subgoal):
 1. \<And>Y y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X; matrix_change_of_basis y X = matrix_change_of_basis Y X; is_basis (set_of_vector y)\<rbrakk> \<Longrightarrow> Y = y
[PROOF STEP]
fix Y Z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Y y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X; matrix_change_of_basis y X = matrix_change_of_basis Y X; is_basis (set_of_vector y)\<rbrakk> \<Longrightarrow> Y = y
[PROOF STEP]
assume basis_Y:"is_basis (set_of_vector Y)" and eq: "matrix_change_of_basis Z X = matrix_change_of_basis Y X" and basis_Z: "is_basis (set_of_vector Z)"
[PROOF STATE]
proof (state)
this:
is_basis (set_of_vector Y)
matrix_change_of_basis Z X = matrix_change_of_basis Y X
is_basis (set_of_vector Z)

goal (1 subgoal):
 1. \<And>Y y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X; matrix_change_of_basis y X = matrix_change_of_basis Y X; is_basis (set_of_vector y)\<rbrakk> \<Longrightarrow> Y = y
[PROOF STEP]
have ZY_coord: "\<forall>i. coord X (Z$i) = coord X (Y$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. coord X (Z $ i) = coord X (Y $ i)
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
matrix_change_of_basis Z X = matrix_change_of_basis Y X

goal (1 subgoal):
 1. \<forall>i. coord X (Z $ i) = coord X (Y $ i)
[PROOF STEP]
unfolding matrix_change_of_basis_def
[PROOF STATE]
proof (prove)
using this:
(\<chi>i j. coord X (Z $ j) $ i) = (\<chi>i j. coord X (Y $ j) $ i)

goal (1 subgoal):
 1. \<forall>i. coord X (Z $ i) = coord X (Y $ i)
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>i ia. (\<chi>i j. coord X (Z $ j) $ i) $ i $ ia = (\<chi>i j. coord X (Y $ j) $ i) $ i $ ia

goal (1 subgoal):
 1. \<forall>i ia. coord X (Z $ i) $ ia = coord X (Y $ i) $ ia
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
\<forall>i. coord X (Z $ i) = coord X (Y $ i)

goal (1 subgoal):
 1. \<And>Y y. \<lbrakk>is_basis (set_of_vector Y); P = matrix_change_of_basis Y X; matrix_change_of_basis y X = matrix_change_of_basis Y X; is_basis (set_of_vector y)\<rbrakk> \<Longrightarrow> Y = y
[PROOF STEP]
show "Y=Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y = Z
[PROOF STEP]
by (vector, metis ZY_coord coord_eq[OF basis_X])
[PROOF STATE]
proof (state)
this:
Y = Z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interleavings_distinct:
  assumes "interleavings xs ys zs"
  shows "distinct xs \<and> distinct ys \<and> set xs \<inter> set ys = {} \<longleftrightarrow> distinct zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (distinct xs \<and> distinct ys \<and> set xs \<inter> set ys = {}) = distinct zs
[PROOF STEP]
using assms interleavings_set
[PROOF STATE]
proof (prove)
using this:
interleavings xs ys zs
interleavings ?xs ?ys ?zs \<Longrightarrow> set ?xs \<union> set ?ys = set ?zs

goal (1 subgoal):
 1. (distinct xs \<and> distinct ys \<and> set xs \<inter> set ys = {}) = distinct zs
[PROOF STEP]
by (induct xs ys zs rule: interleavings.induct) fastforce+


[STATEMENT]
lemma prodinf_divide_initial_segment:
  assumes "convergent_prod f" "\<And>i. i < n \<Longrightarrow> f i \<noteq> 0"
  shows "(\<Prod>i. f (i + n)) = (\<Prod>i. f i) / (\<Prod>i<n. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i. f (i + n)) = (\<Prod>i. f i) / prod f {..<n}
[PROOF STEP]
by (rule has_prod_unique[symmetric]) (auto simp: assms has_prod_iff_shift)


[STATEMENT]
lemma primitive_part_reflect_poly:
  fixes f :: "'a :: {semiring_gcd,idom} poly"
  shows "primitive_part (reflect_poly f) = reflect_poly (primitive_part f)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
using content_times_primitive_part[of "reflect_poly f"]
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f

goal (1 subgoal):
 1. primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
note content_reflect_poly[of f, symmetric]
[PROOF STATE]
proof (state)
this:
content f = content (reflect_poly f)

goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
content f = content (reflect_poly f)

goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
have "smult (content (reflect_poly f)) ?l = reflect_poly f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f

goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f

goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
have "... = reflect_poly (smult (content f) (primitive_part f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly f = reflect_poly (Polynomial.smult (content f) (primitive_part f))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
reflect_poly f = reflect_poly (Polynomial.smult (content f) (primitive_part f))

goal (1 subgoal):
 1. Polynomial.smult (content (reflect_poly f)) (primitive_part (reflect_poly f)) = reflect_poly f \<Longrightarrow> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polynomial.smult (content f) (primitive_part (reflect_poly f)) = reflect_poly (Polynomial.smult (content f) (primitive_part f))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polynomial.smult (content f) (primitive_part (reflect_poly f)) = reflect_poly (Polynomial.smult (content f) (primitive_part f))

goal (1 subgoal):
 1. primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
unfolding reflect_poly_smult smult_cancel
[PROOF STATE]
proof (prove)
using this:
content f = (0::'a) \<or> primitive_part (reflect_poly f) = reflect_poly (primitive_part f)

goal (1 subgoal):
 1. primitive_part (reflect_poly f) = reflect_poly (primitive_part f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
primitive_part (reflect_poly f) = reflect_poly (primitive_part f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_set_inj:
  "\<lbrakk> finite xs; finite ys; sorted_list_of_set xs = sorted_list_of_set ys \<rbrakk>
   \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite xs; finite ys; sorted_list_of_set xs = sorted_list_of_set ys\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (simp add:sorted_list_of_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite xs; finite ys; sorted_key_list_of_set (\<lambda>x. x) xs = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
apply (induct xs rule:finite_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>finite ys; sorted_key_list_of_set (\<lambda>x. x) {} = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> {} = ys
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>finite ys; sorted_key_list_of_set (\<lambda>x. x) F = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> F = ys; finite ys; sorted_key_list_of_set (\<lambda>x. x) (insert x F) = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> insert x F = ys
[PROOF STEP]
apply (induct ys rule:finite_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. sorted_key_list_of_set (\<lambda>x. x) {} = sorted_key_list_of_set (\<lambda>x. x) {} \<Longrightarrow> {} = {}
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sorted_key_list_of_set (\<lambda>x. x) {} = sorted_key_list_of_set (\<lambda>x. x) F \<Longrightarrow> {} = F; sorted_key_list_of_set (\<lambda>x. x) {} = sorted_key_list_of_set (\<lambda>x. x) (insert x F)\<rbrakk> \<Longrightarrow> {} = insert x F
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>finite ys; sorted_key_list_of_set (\<lambda>x. x) F = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> F = ys; finite ys; sorted_key_list_of_set (\<lambda>x. x) (insert x F) = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> insert x F = ys
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sorted_key_list_of_set (\<lambda>x. x) (insert x F) = sorted_key_list_of_set (\<lambda>x. x) F \<Longrightarrow> {} = F; sorted_key_list_of_set (\<lambda>x. x) {} = sorted_key_list_of_set (\<lambda>x. x) (insert x F)\<rbrakk> \<Longrightarrow> False
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; sorted_key_list_of_set (\<lambda>x. x) F = sorted_key_list_of_set (\<lambda>x. x) ys \<Longrightarrow> F = ys; finite ys; sorted_key_list_of_set (\<lambda>x. x) (insert x F) = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> insert x F = ys
[PROOF STEP]
apply (metis finite.insertI insert_not_empty sorted_list_of_set_def sorted_list_of_set_empty sorted_list_of_set_eq_Nil_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; sorted_key_list_of_set (\<lambda>x. x) F = sorted_key_list_of_set (\<lambda>x. x) ys \<Longrightarrow> F = ys; finite ys; sorted_key_list_of_set (\<lambda>x. x) (insert x F) = sorted_key_list_of_set (\<lambda>x. x) ys\<rbrakk> \<Longrightarrow> insert x F = ys
[PROOF STEP]
apply (metis finite.insertI finite_list set_remdups set_sort sorted_list_of_set_def sorted_list_of_set_sort_remdups)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_Arg_exp_diff_2pi:
  assumes "is_Arg (exp z) \<theta>"
  shows "\<exists>k. Im z - of_int k * (2 * pi) = \<theta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. Im z - real_of_int k * (2 * pi) = \<theta>
[PROOF STEP]
proof (intro exI is_Arg_eqI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. is_Arg ?z1 (Im z - real_of_int ?k * (2 * pi))
 2. is_Arg ?z1 \<theta>
 3. \<bar>Im z - real_of_int ?k * (2 * pi) - \<theta>\<bar> < 2 * pi
 4. ?z1 \<noteq> 0
[PROOF STEP]
let ?k = "\<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor>"
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. is_Arg ?z1 (Im z - real_of_int ?k * (2 * pi))
 2. is_Arg ?z1 \<theta>
 3. \<bar>Im z - real_of_int ?k * (2 * pi) - \<theta>\<bar> < 2 * pi
 4. ?z1 \<noteq> 0
[PROOF STEP]
show "is_Arg (exp z) (Im z - real_of_int ?k * (2 * pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Arg (exp z) (Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi))
[PROOF STEP]
by (metis diff_add_cancel is_Arg_2pi_iff is_Arg_exp_Im)
[PROOF STATE]
proof (state)
this:
is_Arg (exp z) (Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi))

goal (3 subgoals):
 1. is_Arg (exp z) \<theta>
 2. \<bar>Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi) - \<theta>\<bar> < 2 * pi
 3. exp z \<noteq> 0
[PROOF STEP]
show "\<bar>Im z - real_of_int ?k * (2 * pi) - \<theta>\<bar> < 2 * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi) - \<theta>\<bar> < 2 * pi
[PROOF STEP]
using floor_divide_upper [of "2*pi" "Im z - \<theta>"] floor_divide_lower [of "2*pi" "Im z - \<theta>"]
[PROOF STATE]
proof (prove)
using this:
0 < 2 * pi \<Longrightarrow> Im z - \<theta> < (real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> + 1) * (2 * pi)
0 < 2 * pi \<Longrightarrow> real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi) \<le> Im z - \<theta>

goal (1 subgoal):
 1. \<bar>Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi) - \<theta>\<bar> < 2 * pi
[PROOF STEP]
by (auto simp: algebra_simps abs_if)
[PROOF STATE]
proof (state)
this:
\<bar>Im z - real_of_int \<lfloor>(Im z - \<theta>) / (2 * pi)\<rfloor> * (2 * pi) - \<theta>\<bar> < 2 * pi

goal (2 subgoals):
 1. is_Arg (exp z) \<theta>
 2. exp z \<noteq> 0
[PROOF STEP]
qed (auto simp: is_Arg_exp_Im assms)


[STATEMENT]
lemma sq_norm_vec_le_linf_norm:
  fixes v :: "'a :: {conjugatable_ring_1_abs_real_line} vec"
  assumes "v \<in> carrier_vec n"
  shows "\<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
proof (insert assms, induct rule: carrier_vec_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<parallel>vNil\<parallel>\<^sup>2 \<le> of_nat 0 * \<parallel>vNil\<parallel>\<^sub>\<infinity>\<^sup>2
 2. \<And>n a v. \<lbrakk>v \<in> carrier_vec n; \<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2\<rbrakk> \<Longrightarrow> \<parallel>vCons a v\<parallel>\<^sup>2 \<le> of_nat (Suc n) * \<parallel>vCons a v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
case (Suc n a v)
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec n
\<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2

goal (2 subgoals):
 1. \<parallel>vNil\<parallel>\<^sup>2 \<le> of_nat 0 * \<parallel>vNil\<parallel>\<^sub>\<infinity>\<^sup>2
 2. \<And>n a v. \<lbrakk>v \<in> carrier_vec n; \<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2\<rbrakk> \<Longrightarrow> \<parallel>vCons a v\<parallel>\<^sup>2 \<le> of_nat (Suc n) * \<parallel>vCons a v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
have [dest!]: "\<not> \<bar>a\<bar> \<le> \<parallel>v\<parallel>\<^sub>\<infinity> \<Longrightarrow> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2 \<le> of_nat n * \<bar>a\<bar>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> \<bar>a\<bar> \<le> \<parallel>v\<parallel>\<^sub>\<infinity> \<Longrightarrow> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2 \<le> of_nat n * \<bar>a\<bar>\<^sup>2
[PROOF STEP]
by (rule real_linorder_cases[of "\<bar>a\<bar>" "\<parallel>v\<parallel>\<^sub>\<infinity>"], insert Suc, auto simp: less_le intro!: power_mono mult_left_mono)
[PROOF STATE]
proof (state)
this:
\<not> \<bar>a\<bar> \<le> \<parallel>v\<parallel>\<^sub>\<infinity> \<Longrightarrow> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2 \<le> of_nat n * \<bar>a\<bar>\<^sup>2

goal (2 subgoals):
 1. \<parallel>vNil\<parallel>\<^sup>2 \<le> of_nat 0 * \<parallel>vNil\<parallel>\<^sub>\<infinity>\<^sup>2
 2. \<And>n a v. \<lbrakk>v \<in> carrier_vec n; \<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2\<rbrakk> \<Longrightarrow> \<parallel>vCons a v\<parallel>\<^sup>2 \<le> of_nat (Suc n) * \<parallel>vCons a v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier_vec n
\<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
\<parallel>v\<parallel>\<^sup>2 \<le> of_nat n * \<parallel>v\<parallel>\<^sub>\<infinity>\<^sup>2

goal (1 subgoal):
 1. \<parallel>vCons a v\<parallel>\<^sup>2 \<le> of_nat (Suc n) * \<parallel>vCons a v\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
by (auto simp: ring_distribs max_def intro!:add_mono power_mono)
[PROOF STATE]
proof (state)
this:
\<parallel>vCons a v\<parallel>\<^sup>2 \<le> of_nat (Suc n) * \<parallel>vCons a v\<parallel>\<^sub>\<infinity>\<^sup>2

goal (1 subgoal):
 1. \<parallel>vNil\<parallel>\<^sup>2 \<le> of_nat 0 * \<parallel>vNil\<parallel>\<^sub>\<infinity>\<^sup>2
[PROOF STEP]
qed simp


[STATEMENT]
theorem has_laplace_vector_derivative:
  "((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s"
  if L: "(f has_laplace L) s"
    and f': "\<And>t. t > 0 \<Longrightarrow> f differentiable (at t)"
    and f0: "(f \<longlongrightarrow> f0) (at_right 0)"
    and eo: "exponential_order M c f"
    and cs: "c < Re s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s
[PROOF STEP]
have f': "(\<And>t. 0 < t \<Longrightarrow> (f has_vector_derivative vector_derivative f (at t)) (at t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. 0 < t \<Longrightarrow> (f has_vector_derivative vector_derivative f (at t)) (at t)
[PROOF STEP]
using f'
[PROOF STATE]
proof (prove)
using this:
0 < ?t \<Longrightarrow> f differentiable at ?t

goal (1 subgoal):
 1. \<And>t. 0 < t \<Longrightarrow> (f has_vector_derivative vector_derivative f (at t)) (at t)
[PROOF STEP]
by (subst vector_derivative_works[symmetric])
[PROOF STATE]
proof (state)
this:
0 < ?t \<Longrightarrow> (f has_vector_derivative vector_derivative f (at ?t)) (at ?t)

goal (1 subgoal):
 1. ((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s
[PROOF STEP]
by (rule has_laplace_derivative_time_domain[OF L f' f0 eo cs])
[PROOF STATE]
proof (state)
this:
((\<lambda>t. vector_derivative f (at t)) has_laplace s * L - f0) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem KL_div_pos2:
  fixes a d::"'b \<Rightarrow> real"
  assumes fin: "finite S"
  assumes non_null: "\<And>i. i\<in>S \<Longrightarrow> 0 \<le> a i" "\<And>i. i\<in> S \<Longrightarrow> 0 < d i"
  assumes sum_a_one: "(\<Sum> i \<in> S. a i) = 1"
  assumes sum_c_one: "(\<Sum> i \<in> S. d i) = 1"
shows "0 \<le> KL_div S a d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
have "S = (S \<inter> {i. 0 < a i}) \<union> (S \<inter> {i. 0 = a i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}
[PROOF STEP]
using non_null(1)
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> 0 \<le> a ?i14

goal (1 subgoal):
 1. S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
have "(S \<inter> {i. 0 < a i}) \<inter> (S \<inter> {i. 0 = a i}) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<inter> (S \<inter> {i. 0 = a i}) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<inter> {i. 0 < a i} \<inter> (S \<inter> {i. 0 = a i}) = {}

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}
S \<inter> {i. 0 < a i} \<inter> (S \<inter> {i. 0 = a i}) = {}
[PROOF STEP]
have
    eq: "KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d + KL_div (S \<inter> {i. 0 = a i}) a d"
[PROOF STATE]
proof (prove)
using this:
S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}
S \<inter> {i. 0 < a i} \<inter> (S \<inter> {i. 0 = a i}) = {}

goal (1 subgoal):
 1. KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d + KL_div (S \<inter> {i. 0 = a i}) a d
[PROOF STEP]
unfolding KL_div_def
[PROOF STATE]
proof (prove)
using this:
S = S \<inter> {i. 0 < a i} \<union> S \<inter> {i. 0 = a i}
S \<inter> {i. 0 < a i} \<inter> (S \<inter> {i. 0 = a i}) = {}

goal (1 subgoal):
 1. (\<Sum>i\<in>S. a i * log b (a i / d i)) = (\<Sum>i\<in>S \<inter> {i. 0 < a i}. a i * log b (a i / d i)) + (\<Sum>i\<in>S \<inter> {i. 0 = a i}. a i * log b (a i / d i))
[PROOF STEP]
by (metis (mono_tags, lifting) fin finite_Un sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d + KL_div (S \<inter> {i. 0 = a i}) a d

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
have "KL_div (S \<inter> {i. 0 = a i}) a d = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KL_div (S \<inter> {i. 0 = a i}) a d = 0
[PROOF STEP]
unfolding KL_div_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>S \<inter> {i. 0 = a i}. a i * log b (a i / d i)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
KL_div (S \<inter> {i. 0 = a i}) a d = 0

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
hence "KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d"
[PROOF STATE]
proof (prove)
using this:
KL_div (S \<inter> {i. 0 = a i}) a d = 0

goal (1 subgoal):
 1. KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
KL_div (S \<inter> {i. 0 = a i}) a d = 0
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d + KL_div (S \<inter> {i. 0 = a i}) a d

goal (1 subgoal):
 1. KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
have "0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
proof(cases "(S \<inter> {i. 0 < a i}) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S \<inter> {i. 0 < a i} = {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
 2. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S \<inter> {i. 0 < a i} = {}

goal (2 subgoals):
 1. S \<inter> {i. 0 < a i} = {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
 2. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<inter> {i. 0 < a i} = {}

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
unfolding KL_div_def
[PROOF STATE]
proof (prove)
using this:
S \<inter> {i. 0 < a i} = {}

goal (1 subgoal):
 1. 0 \<le> (\<Sum>i\<in>S \<inter> {i. 0 < a i}. a i * log b (a i / d i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<inter> {i. 0 < a i} \<noteq> {}

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
let ?c = "\<lambda>i. d i / (\<Sum>j \<in>(S \<inter> {i. 0 < a i}). d j)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have 1: "(\<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < a i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < a ?i14

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have 2: "(\<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < ?c i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d i / sum d (S \<inter> {i. 0 < a i})
[PROOF STEP]
by (metis False IntD1 divide_pos_pos fin finite_Int non_null(2) sum_pos)
[PROOF STATE]
proof (state)
this:
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d ?i14 / sum d (S \<inter> {i. 0 < a i})

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have 3: "(\<Sum>i\<in> (S \<inter> {i. 0 < a i}). a i) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum a (S \<inter> {i. 0 < a i}) = 1
[PROOF STEP]
using sum.cong[of S, of S, of "(\<lambda>x. if x \<in> {i. 0 < a i} then a x else 0)", of a]
      sum.inter_restrict[OF fin, of a] non_null(1) sum_a_one
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>S = S; \<And>x. x \<in> S \<Longrightarrow> (if x \<in> {i. 0 < a i} then a x else 0) = a x\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>S. if x \<in> {i. 0 < a i} then a x else 0) = sum a S
sum a (S \<inter> ?B) = (\<Sum>x\<in>S. if x \<in> ?B then a x else 0)
?i14 \<in> S \<Longrightarrow> 0 \<le> a ?i14
sum a S = 1

goal (1 subgoal):
 1. sum a (S \<inter> {i. 0 < a i}) = 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sum a (S \<inter> {i. 0 < a i}) = 1

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have "(\<Sum>i\<in>S \<inter> {j. 0 < a j}. ?c i) = (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i) / (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = sum d (S \<inter> {j. 0 < a j}) / sum d (S \<inter> {j. 0 < a j})
[PROOF STEP]
by (metis sum_divide_distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = sum d (S \<inter> {j. 0 < a j}) / sum d (S \<inter> {j. 0 < a j})

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
hence 5: "(\<Sum>i\<in>S \<inter> {j. 0 < a j}. ?c i) = 1"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = sum d (S \<inter> {j. 0 < a j}) / sum d (S \<inter> {j. 0 < a j})

goal (1 subgoal):
 1. (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1
[PROOF STEP]
using 2 False
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = sum d (S \<inter> {j. 0 < a j}) / sum d (S \<inter> {j. 0 < a j})
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d ?i14 / sum d (S \<inter> {i. 0 < a i})
S \<inter> {i. 0 < a i} \<noteq> {}

goal (1 subgoal):
 1. (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
hence "0 \<le> KL_div (S \<inter> {j. 0 < a j}) a ?c"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
using KL_div_pos_gen[
      OF finite_Int[OF disjI1, of S, of "{j. 0 < a j}"], of a, of ?c
      ] 1 2 3
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1
\<lbrakk>finite S; \<And>i. i \<in> S \<inter> {j. 0 < a j} \<Longrightarrow> 0 < a i; \<And>i. i \<in> S \<inter> {j. 0 < a j} \<Longrightarrow> 0 < d i / sum d (S \<inter> {i. 0 < a i}); sum a (S \<inter> {j. 0 < a j}) = 1; (\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1\<rbrakk> \<Longrightarrow> 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < a ?i14
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d ?i14 / sum d (S \<inter> {i. 0 < a i})
sum a (S \<inter> {i. 0 < a i}) = 1

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
by (metis fin)
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have fstdb: "0 < (\<Sum>i\<in>S \<inter> {i. 0 < a i}. d i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sum d (S \<inter> {i. 0 < a i})
[PROOF STEP]
using non_null(2) False
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<Longrightarrow> 0 < d ?i14
S \<inter> {i. 0 < a i} \<noteq> {}

goal (1 subgoal):
 1. 0 < sum d (S \<inter> {i. 0 < a i})
[PROOF STEP]
by (metis Int_Collect fin finite_Int sum_pos)
[PROOF STATE]
proof (state)
this:
0 < sum d (S \<inter> {i. 0 < a i})

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have 6: "0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / (\<Sum>i\<in>(S \<inter> {i. 0 < a i}). d i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
using 2 3 5
        KL_div_pos_gen[
      OF finite_Int[OF disjI1, OF fin], of "{i. 0 < a i}", of "a", of "?c"
      ]
[PROOF STATE]
proof (prove)
using this:
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d ?i14 / sum d (S \<inter> {i. 0 < a i})
sum a (S \<inter> {i. 0 < a i}) = 1
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1
\<lbrakk>\<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < a i; \<And>i. i \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d i / sum d (S \<inter> {i. 0 < a i}); sum a (S \<inter> {i. 0 < a i}) = 1; (\<Sum>i\<in>S \<inter> {i. 0 < a i}. d i / sum d (S \<inter> {i. 0 < a i})) = 1\<rbrakk> \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
hence
      "KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / (\<Sum>i\<in>(S \<inter> {i. 0 < a i}). d i)) \<le> KL_div (S \<inter> {j. 0 < a j}) a d"
[PROOF STATE]
proof (prove)
using this:
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d
[PROOF STEP]
using non_null sum.inter_restrict[OF fin, of d, of "{i. 0 < a i}"]
        sum_mono[of S, of "(\<lambda>x. if x \<in> {i. 0 < a i} then d x else 0)", of d] non_null(2) sum_c_one
        non_null(2) fstdb KL_div_mul
[PROOF STATE]
proof (prove)
using this:
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
?i14 \<in> S \<Longrightarrow> 0 \<le> a ?i14
?i14 \<in> S \<Longrightarrow> 0 < d ?i14
sum d (S \<inter> {i. 0 < a i}) = (\<Sum>x\<in>S. if x \<in> {i. 0 < a i} then d x else 0)
(\<And>i. i \<in> S \<Longrightarrow> (if i \<in> {i. 0 < a i} then d i else 0) \<le> d i) \<Longrightarrow> (\<Sum>i\<in>S. if i \<in> {i. 0 < a i} then d i else 0) \<le> sum d S
?i14 \<in> S \<Longrightarrow> 0 < d ?i14
sum d S = 1
?i14 \<in> S \<Longrightarrow> 0 < d ?i14
0 < sum d (S \<inter> {i. 0 < a i})
\<lbrakk>0 < ?d; ?d \<le> 1; \<And>i. i \<in> ?S \<Longrightarrow> 0 \<le> ?a i; \<And>i. i \<in> ?S \<Longrightarrow> 0 < ?e i\<rbrakk> \<Longrightarrow> KL_div ?S ?a (\<lambda>i. ?e i / ?d) \<le> KL_div ?S ?a ?e

goal (1 subgoal):
 1. KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
have "0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / (\<Sum>i\<in>(S \<inter> {i. 0 < a i}). d i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
using KL_div_pos_gen[ OF finite_Int[OF disjI1, OF fin]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> S \<inter> ?G1 \<Longrightarrow> 0 < ?a i; \<And>i. i \<in> S \<inter> ?G1 \<Longrightarrow> 0 < ?d i; sum ?a (S \<inter> ?G1) = 1; sum ?d (S \<inter> ?G1) = 1\<rbrakk> \<Longrightarrow> 0 \<le> KL_div (S \<inter> ?G1) ?a ?d

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
using 2 3 5
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> S \<inter> ?G1 \<Longrightarrow> 0 < ?a i; \<And>i. i \<in> S \<inter> ?G1 \<Longrightarrow> 0 < ?d i; sum ?a (S \<inter> ?G1) = 1; sum ?d (S \<inter> ?G1) = 1\<rbrakk> \<Longrightarrow> 0 \<le> KL_div (S \<inter> ?G1) ?a ?d
?i14 \<in> S \<inter> {i. 0 < a i} \<Longrightarrow> 0 < d ?i14 / sum d (S \<inter> {i. 0 < a i})
sum a (S \<inter> {i. 0 < a i}) = 1
(\<Sum>i\<in>S \<inter> {j. 0 < a j}. d i / sum d (S \<inter> {i. 0 < a i})) = 1

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. S \<inter> {i. 0 < a i} \<noteq> {} \<Longrightarrow> 0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d
0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))
[PROOF STEP]
show "0 \<le> KL_div (S \<inter> {j. 0 < a j}) a d"
[PROOF STATE]
proof (prove)
using this:
KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i})) \<le> KL_div (S \<inter> {j. 0 < a j}) a d
0 \<le> KL_div (S \<inter> {j. 0 < a j}) a (\<lambda>i. d i / sum d (S \<inter> {i. 0 < a i}))

goal (1 subgoal):
 1. 0 \<le> KL_div (S \<inter> {j. 0 < a j}) a d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {j. 0 < a j}) a d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
KL_div S a d = KL_div (S \<inter> {i. 0 < a i}) a d
0 \<le> KL_div (S \<inter> {i. 0 < a i}) a d

goal (1 subgoal):
 1. 0 \<le> KL_div S a d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> KL_div S a d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_spmf_spmf_of_pmf [simp]: "rel_spmf R (spmf_of_pmf p) (spmf_of_pmf q) = rel_pmf R p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_spmf R (spmf_of_pmf p) (spmf_of_pmf q) = rel_pmf R p q
[PROOF STEP]
by(simp add: spmf_of_pmf_def pmf.rel_map)


[STATEMENT]
lemma prefixeq_antisym: "\<lbrakk> prefix xs ys; prefix (ys::'a list) xs \<rbrakk> \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prefix xs ys; prefix ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by (rule prefix_order.antisym)


[STATEMENT]
lemma fun_set_rel_RUNIV[relator_props]:
  assumes SV: "single_valued R"
  shows "Range (\<langle>R\<rangle>fun_set_rel) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
have "\<exists>a. (a,b)\<in>\<langle>R\<rangle>fun_set_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. (a, b) \<in> \<langle>R\<rangle>fun_set_rel
[PROOF STEP]
unfolding fun_set_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. (a, b) \<in> (R \<rightarrow> bool_rel) O br Collect (\<lambda>_. True)
[PROOF STEP]
apply (rule exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (?a, b) \<in> (R \<rightarrow> bool_rel) O br Collect (\<lambda>_. True)
[PROOF STEP]
apply (rule relcompI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (?a, ?b2) \<in> R \<rightarrow> bool_rel
 2. (?b2, b) \<in> br Collect (\<lambda>_. True)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?a, ?b2) \<in> R \<rightarrow> bool_rel
 2. (?b2, b) \<in> br Collect (\<lambda>_. True)
[PROOF STEP]
show "((\<lambda>x. x\<in>b),b)\<in>br Collect (\<lambda>_. True)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<in> b, b) \<in> br Collect (\<lambda>_. True)
[PROOF STEP]
by (auto simp: br_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x \<in> b, b) \<in> br Collect (\<lambda>_. True)

goal (1 subgoal):
 1. (?a, \<lambda>x. x \<in> b) \<in> R \<rightarrow> bool_rel
[PROOF STEP]
show "(\<lambda>x'. \<exists>x. (x',x)\<in>R \<and> x\<in>b,\<lambda>x. x \<in> b)\<in>R \<rightarrow> bool_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x'. \<exists>x. (x', x) \<in> R \<and> x \<in> b, \<lambda>x. x \<in> b) \<in> R \<rightarrow> bool_rel
[PROOF STEP]
by (auto dest: single_valuedD[OF SV])
[PROOF STATE]
proof (state)
this:
(\<lambda>x'. \<exists>x. (x', x) \<in> R \<and> x \<in> b, \<lambda>x. x \<in> b) \<in> R \<rightarrow> bool_rel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>a. (a, b) \<in> \<langle>R\<rangle>fun_set_rel

goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<exists>a. (a, ?b2) \<in> \<langle>R\<rangle>fun_set_rel

goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>a. (a, ?b2) \<in> \<langle>R\<rangle>fun_set_rel

goal (1 subgoal):
 1. Range (\<langle>R\<rangle>fun_set_rel) = UNIV
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Range (\<langle>R\<rangle>fun_set_rel) = UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_power_inject_base: "\<lbrakk> n \<noteq> 0; a^n = b^n \<rbrakk> \<Longrightarrow> (a::nat) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n = b ^ n\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n = b ^ n\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
assume "n \<noteq> 0" and ab: "a^n = b^n"
[PROOF STATE]
proof (state)
this:
n \<noteq> 0
a ^ n = b ^ n

goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n = b ^ n\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
a ^ n = b ^ n
[PROOF STEP]
obtain m where "n = Suc m"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
a ^ n = b ^ n

goal (1 subgoal):
 1. (\<And>m. n = Suc m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (frule_tac n="n" in not0_implies_Suc, auto)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n = b ^ n\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
with ab
[PROOF STATE]
proof (chain)
picking this:
a ^ n = b ^ n
n = Suc m
[PROOF STEP]
have "a^Suc m = b^Suc m" and "a \<ge> 0" and "b \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
a ^ n = b ^ n
n = Suc m

goal (1 subgoal):
 1. a ^ Suc m = b ^ Suc m &&& 0 \<le> a &&& 0 \<le> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a ^ Suc m = b ^ Suc m
0 \<le> a
0 \<le> b

goal (1 subgoal):
 1. \<lbrakk>n \<noteq> 0; a ^ n = b ^ n\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a ^ Suc m = b ^ Suc m
0 \<le> a
0 \<le> b

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by (rule power_inject_base)
[PROOF STATE]
proof (state)
this:
a = b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_Chains_conv_chain: "M \<in> Chains r \<longleftrightarrow> Complete_Partial_Order.chain (\<lambda>x y. (x, y) \<in> r) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M \<in> Chains r) = Complete_Partial_Order.chain (\<lambda>x y. (x, y) \<in> r) M
[PROOF STEP]
by(simp add: Chains_def chain_def)


[STATEMENT]
lemma rtrancl_edges_pathE:
  assumes "(u,v)\<in>(edges g)\<^sup>*" obtains p where "path g u p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. path g u p v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(u, v) \<in> (edges g)\<^sup>*

goal (1 subgoal):
 1. (\<And>p. path g u p v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: rtrancl_edges_iff_path)


[STATEMENT]
lemma translation_composition_eq [simp]:
  assumes [simp]: "a \<in> G" "b \<in> G"
  shows "compose G (a)\<^sub>R (b)\<^sub>R = (b \<cdot> a)\<^sub>R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose G (a)\<^sub>R (b)\<^sub>R = (b \<cdot> a)\<^sub>R
[PROOF STEP]
unfolding translation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose G ((\<lambda>a\<in>G. \<lambda>x\<in>G. x \<cdot> a) a) ((\<lambda>a\<in>G. \<lambda>x\<in>G. x \<cdot> a) b) = (\<lambda>a\<in>G. \<lambda>x\<in>G. x \<cdot> a) (b \<cdot> a)
[PROOF STEP]
by rule (simp add: associative compose_def)


[STATEMENT]
lemma emptyset_part_emptyset2:
  assumes "P partitions {}"
  shows "P = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P partitions {}

goal (1 subgoal):
 1. P = {}
[PROOF STEP]
unfolding is_partition_of_def is_non_overlapping_def
[PROOF STATE]
proof (prove)
using this:
\<Union> P = {} \<and> (\<forall>X\<in>P. \<forall>Y\<in>P. (X \<inter> Y \<noteq> {}) = (X = Y))

goal (1 subgoal):
 1. P = {}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma two_32: "2 ^ LENGTH(32) = (4294967296 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ LENGTH(32) = 4294967296
[PROOF STEP]
by simp


[STATEMENT]
lemma coprime_iff_invertible'_nat:
  assumes "m > 0"
  shows "coprime a m \<longleftrightarrow> (\<exists>x. 0 \<le> x \<and> x < m \<and> [a * x = Suc 0] (mod m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))
[PROOF STEP]
have "\<And>b. \<lbrakk>0 < m; [a * b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>0 < m; [a * b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)
[PROOF STEP]
by (metis cong_def mod_less_divisor [OF assms] mod_mult_right_eq)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < m; [a * ?b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)

goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < m; [a * ?b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < m; [a * ?b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)

goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))
[PROOF STEP]
using assms coprime_iff_invertible_nat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < m; [a * ?b = Suc 0] (mod m)\<rbrakk> \<Longrightarrow> \<exists>b'<m. [a * b' = Suc 0] (mod m)
0 < m
coprime ?a ?m = (\<exists>x. [?a * x = Suc 0] (mod ?m))

goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = Suc 0] (mod m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_diag_spectrum_eq:
  fixes A::"complex Matrix.mat"
  assumes "A\<in> carrier_mat n n"
  and "unitary_diag A B U"
shows "spectrum A = set (diag_mat B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spectrum A = set (diag_mat B)
[PROOF STEP]
proof (rule similar_spectrum_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A \<in> carrier_mat ?n ?n
 2. similar_mat A B
 3. upper_triangular B
[PROOF STEP]
show "A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
unitary_diag A B U

goal (1 subgoal):
 1. A \<in> carrier_mat n n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (2 subgoals):
 1. similar_mat A B
 2. upper_triangular B
[PROOF STEP]
show "similar_mat A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
using assms unitary_diagD(1)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
unitary_diag A B U
unitary_diag ?A ?B ?U \<Longrightarrow> similar_mat_wit ?A ?B ?U (Complex_Matrix.adjoint ?U)

goal (1 subgoal):
 1. similar_mat A B
[PROOF STEP]
by (metis similar_mat_def)
[PROOF STATE]
proof (state)
this:
similar_mat A B

goal (1 subgoal):
 1. upper_triangular B
[PROOF STEP]
show "upper_triangular B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular B
[PROOF STEP]
using assms
    unitary_diagD(2) unitary_diagD(1)  diagonal_imp_upper_triangular
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
unitary_diag A B U
unitary_diag ?A ?B ?U \<Longrightarrow> diagonal_mat ?B
unitary_diag ?A ?B ?U \<Longrightarrow> similar_mat_wit ?A ?B ?U (Complex_Matrix.adjoint ?U)
\<lbrakk>diagonal_mat ?A; ?A \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> upper_triangular ?A

goal (1 subgoal):
 1. upper_triangular B
[PROOF STEP]
by (metis similar_mat_witD2(5))
[PROOF STATE]
proof (state)
this:
upper_triangular B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fdomain_small[simp]: "small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}
[PROOF STEP]
have ss: "{a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r} \<subseteq> (\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r} \<subseteq> (\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r
[PROOF STEP]
using image_iff
[PROOF STATE]
proof (prove)
using this:
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r} \<subseteq> (\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r} \<subseteq> (\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r

goal (1 subgoal):
 1. small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}
[PROOF STEP]
have small: "small ((\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small ((\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r)
[PROOF STEP]
by (rule replacement) simp
[PROOF STATE]
proof (state)
this:
small ((\<lambda>x. x\<lparr>0\<^sub>\<nat>\<rparr>) ` elts r)

goal (1 subgoal):
 1. small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}
[PROOF STEP]
by (rule smaller_than_small, rule small, rule ss)
[PROOF STATE]
proof (state)
this:
small {a. \<exists>b. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> r}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_ln_exp [simp]:
  fixes f :: "'a :: dirichlet_series fds"
  assumes "l = fds_nth f (Suc 0)"
  shows   "fds_ln l (fds_exp f) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_ln l (fds_exp f) = f
[PROOF STEP]
proof (rule fds_deriv_eq_imp_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f
 2. fds_nth (fds_ln l (fds_exp f)) (Suc 0) = fds_nth f (Suc 0)
[PROOF STEP]
have "fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * (fds_exp f / fds_exp f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * (fds_exp f / fds_exp f)
[PROOF STEP]
by (simp add: algebra_simps divide_fds_def)
[PROOF STATE]
proof (state)
this:
fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * (fds_exp f / fds_exp f)

goal (2 subgoals):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f
 2. fds_nth (fds_ln l (fds_exp f)) (Suc 0) = fds_nth f (Suc 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * (fds_exp f / fds_exp f)

goal (2 subgoals):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f
 2. fds_nth (fds_ln l (fds_exp f)) (Suc 0) = fds_nth f (Suc 0)
[PROOF STEP]
have "fds_exp f / fds_exp f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_exp f / fds_exp f = 1
[PROOF STEP]
by (simp add: divide_fds_def fds_right_inverse)
[PROOF STATE]
proof (state)
this:
fds_exp f / fds_exp f = 1

goal (2 subgoals):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f
 2. fds_nth (fds_ln l (fds_exp f)) (Suc 0) = fds_nth f (Suc 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * 1
[PROOF STEP]
show "fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f"
[PROOF STATE]
proof (prove)
using this:
fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f * 1

goal (1 subgoal):
 1. fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fds_deriv (fds_ln l (fds_exp f)) = fds_deriv f

goal (1 subgoal):
 1. fds_nth (fds_ln l (fds_exp f)) (Suc 0) = fds_nth f (Suc 0)
[PROOF STEP]
qed (insert assms, auto simp: field_simps)


[STATEMENT]
lemma dfa2wf_nfa:
  assumes "wf_dfa M n"
  shows "wf_nfa (nfa_of_dfa M) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
have "\<And>a. dfa_is_node M a \<Longrightarrow> nfa_is_node (nfa_of_dfa M) ((replicate (length (fst M)) False)[a:=True])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. dfa_is_node M a \<Longrightarrow> nfa_is_node (nfa_of_dfa M) ((replicate (length (fst M)) False)[a := True])
[PROOF STEP]
by (simp add: dfa_is_node_def nfa_is_node_def nfa_of_dfa_def split_beta)
[PROOF STATE]
proof (state)
this:
dfa_is_node M ?a \<Longrightarrow> nfa_is_node (nfa_of_dfa M) ((replicate (length (fst M)) False)[?a := True])

goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
hence "\<And>bdd. bdd_all (dfa_is_node M) bdd \<Longrightarrow> bdd_all (nfa_is_node (nfa_of_dfa M)) (bdd_map (\<lambda>q. (replicate (length (fst M)) False)[q:=True]) bdd)"
[PROOF STATE]
proof (prove)
using this:
dfa_is_node M ?a \<Longrightarrow> nfa_is_node (nfa_of_dfa M) ((replicate (length (fst M)) False)[?a := True])

goal (1 subgoal):
 1. \<And>bdd. bdd_all (dfa_is_node M) bdd \<Longrightarrow> bdd_all (nfa_is_node (nfa_of_dfa M)) (bdd_map (\<lambda>q. (replicate (length (fst M)) False)[q := True]) bdd)
[PROOF STEP]
by (simp add: bdd_all_bdd_map)
[PROOF STATE]
proof (state)
this:
bdd_all (dfa_is_node M) ?bdd \<Longrightarrow> bdd_all (nfa_is_node (nfa_of_dfa M)) (bdd_map (\<lambda>q. (replicate (length (fst M)) False)[q := True]) ?bdd)

goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
wf_dfa M n
bdd_all (dfa_is_node M) ?bdd \<Longrightarrow> bdd_all (nfa_is_node (nfa_of_dfa M)) (bdd_map (\<lambda>q. (replicate (length (fst M)) False)[q := True]) ?bdd)
[PROOF STEP]
have "list_all (bdd_all (nfa_is_node (nfa_of_dfa M))) (fst (nfa_of_dfa M))"
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
bdd_all (dfa_is_node M) ?bdd \<Longrightarrow> bdd_all (nfa_is_node (nfa_of_dfa M)) (bdd_map (\<lambda>q. (replicate (length (fst M)) False)[q := True]) ?bdd)

goal (1 subgoal):
 1. list_all (bdd_all (nfa_is_node (nfa_of_dfa M))) (fst (nfa_of_dfa M))
[PROOF STEP]
by (simp add: list_all_iff split_beta nfa_of_dfa_def wf_dfa_def)
[PROOF STATE]
proof (state)
this:
list_all (bdd_all (nfa_is_node (nfa_of_dfa M))) (fst (nfa_of_dfa M))

goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
wf_dfa M n
list_all (bdd_all (nfa_is_node (nfa_of_dfa M))) (fst (nfa_of_dfa M))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
list_all (bdd_all (nfa_is_node (nfa_of_dfa M))) (fst (nfa_of_dfa M))

goal (1 subgoal):
 1. wf_nfa (nfa_of_dfa M) n
[PROOF STEP]
by (simp add: wf_nfa_def wf_dfa_def nfa_of_dfa_def split_beta list_all_iff bddh_bdd_map)
[PROOF STATE]
proof (state)
this:
wf_nfa (nfa_of_dfa M) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sequence_infinite_lemma:
  fixes f :: "nat \<Rightarrow> 'a::t1_space"
  assumes "\<forall>n. f n \<noteq> l"
    and "(f \<longlongrightarrow> l) sequentially"
  shows "infinite (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (range f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
assume "finite (range f)"
[PROOF STATE]
proof (state)
this:
finite (range f)

goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (range f)
[PROOF STEP]
have "l \<notin> range f \<and> closed (range f)"
[PROOF STATE]
proof (prove)
using this:
finite (range f)

goal (1 subgoal):
 1. l \<notin> range f \<and> closed (range f)
[PROOF STEP]
using \<open>finite (range f)\<close> assms(1) finite_imp_closed
[PROOF STATE]
proof (prove)
using this:
finite (range f)
finite (range f)
\<forall>n. f n \<noteq> l
finite ?S \<Longrightarrow> closed ?S

goal (1 subgoal):
 1. l \<notin> range f \<and> closed (range f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
l \<notin> range f \<and> closed (range f)

goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l \<notin> range f \<and> closed (range f)
[PROOF STEP]
have "eventually (\<lambda>n. f n \<in> - range f) sequentially"
[PROOF STATE]
proof (prove)
using this:
l \<notin> range f \<and> closed (range f)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. f n \<in> - range f
[PROOF STEP]
by (metis Compl_iff assms(2) open_Compl topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. f n \<in> - range f

goal (1 subgoal):
 1. finite (range f) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. f n \<in> - range f
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. f n \<in> - range f

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. f n \<in> - range f

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_down_eq_zero_iff[simp]: "power_down prec b n = 0 \<longleftrightarrow> b = 0 \<and> n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (power_down prec b n = 0) = (b = 0 \<and> n \<noteq> 0)
[PROOF STEP]
proof (induction n arbitrary: b rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x b. (\<And>y b. y < x \<Longrightarrow> (power_down prec b y = 0) = (b = 0 \<and> y \<noteq> 0)) \<Longrightarrow> (power_down prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
case (less x)
[PROOF STATE]
proof (state)
this:
?y < x \<Longrightarrow> (power_down prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)

goal (1 subgoal):
 1. \<And>x b. (\<And>y b. y < x \<Longrightarrow> (power_down prec b y = 0) = (b = 0 \<and> y \<noteq> 0)) \<Longrightarrow> (power_down prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y < x \<Longrightarrow> (power_down prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?y < x \<Longrightarrow> (power_down prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)

goal (1 subgoal):
 1. (power_down prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
using power_down_simp[of _ _ "x - 1"]
[PROOF STATE]
proof (prove)
using this:
?y < x \<Longrightarrow> (power_down prec ?b ?y = 0) = (?b = 0 \<and> ?y \<noteq> 0)
power_down ?p ?x (Suc (x - 1)) = (if odd (x - 1) then truncate_down (Suc ?p) ((power_down ?p ?x (Suc (x - 1) div 2))\<^sup>2) else truncate_down (Suc ?p) (?x * power_down ?p ?x (x - 1)))

goal (1 subgoal):
 1. (power_down prec b x = 0) = (b = 0 \<and> x \<noteq> 0)
[PROOF STEP]
by (cases x) (auto simp add: div2_less_self)
[PROOF STATE]
proof (state)
this:
(power_down prec b x = 0) = (b = 0 \<and> x \<noteq> 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_upto_real:
  assumes "x \<ge> 0"
  shows   "sum_upto real x = of_int (floor x) * (of_int (floor x) + 1) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
have A: "2 * \<Sum>{1..n} = n * Suc n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * \<Sum> {1..n} = n * Suc n
[PROOF STEP]
by (induction n) simp_all
[PROOF STATE]
proof (state)
this:
2 * \<Sum> {1..?n} = ?n * Suc ?n

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
have "2 * sum_upto real x = real (2 * \<Sum>{0<..nat \<lfloor>x\<rfloor>})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * sum_upto real x = real (2 * \<Sum> {0<..nat \<lfloor>x\<rfloor>})
[PROOF STEP]
by (simp add: sum_upto_altdef)
[PROOF STATE]
proof (state)
this:
2 * sum_upto real x = real (2 * \<Sum> {0<..nat \<lfloor>x\<rfloor>})

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * sum_upto real x = real (2 * \<Sum> {0<..nat \<lfloor>x\<rfloor>})

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
have "{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = {1..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
note A
[PROOF STATE]
proof (state)
this:
2 * \<Sum> {1..?n} = ?n * Suc ?n

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * \<Sum> {1..?n} = ?n * Suc ?n

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
have "real (nat \<lfloor>x\<rfloor> * Suc (nat \<lfloor>x\<rfloor>)) = of_int (floor x) * (of_int (floor x) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor> * Suc (nat \<lfloor>x\<rfloor>)) = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. real (nat \<lfloor>x\<rfloor> * Suc (nat \<lfloor>x\<rfloor>)) = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
real (nat \<lfloor>x\<rfloor> * Suc (nat \<lfloor>x\<rfloor>)) = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1)

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1)

goal (1 subgoal):
 1. sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_upto real x = real_of_int \<lfloor>x\<rfloor> * (real_of_int \<lfloor>x\<rfloor> + 1) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_field_derivative_Arcsin:
  assumes "Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1"
    shows "(Arcsin has_field_derivative inverse(cos(Arcsin z))) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)
[PROOF STEP]
have "(sin (Arcsin z))\<^sup>2 \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin (Arcsin z))\<^sup>2 \<noteq> 1
[PROOF STEP]
using assms one_minus_z2_notin_nonpos_Reals
[PROOF STATE]
proof (prove)
using this:
Im z = 0 \<Longrightarrow> \<bar>Re z\<bar> < 1
(Im ?z = 0 \<Longrightarrow> \<bar>Re ?z\<bar> < 1) \<Longrightarrow> 1 - ?z\<^sup>2 \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (sin (Arcsin z))\<^sup>2 \<noteq> 1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(sin (Arcsin z))\<^sup>2 \<noteq> 1

goal (1 subgoal):
 1. (Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(sin (Arcsin z))\<^sup>2 \<noteq> 1
[PROOF STEP]
have "cos (Arcsin z) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(sin (Arcsin z))\<^sup>2 \<noteq> 1

goal (1 subgoal):
 1. cos (Arcsin z) \<noteq> 0
[PROOF STEP]
by (metis diff_0_right power_zero_numeral sin_squared_eq)
[PROOF STATE]
proof (state)
this:
cos (Arcsin z) \<noteq> 0

goal (1 subgoal):
 1. (Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos (Arcsin z) \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos (Arcsin z) \<noteq> 0

goal (1 subgoal):
 1. (Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)
[PROOF STEP]
by (rule has_field_derivative_inverse_basic [OF DERIV_sin _ _ open_ball [of z 1]]) (auto intro: isCont_Arcsin assms)
[PROOF STATE]
proof (state)
this:
(Arcsin has_field_derivative inverse (cos (Arcsin z))) (at z)

goal:
No subgoals!
[PROOF STEP]
qed