[STATEMENT]
lemma arg_conv_arctan:
  assumes "Re z > 0"
  shows   "Arg z = arctan (Im z / Re z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg z = arctan (Im z / Re z)
[PROOF STEP]
proof (rule cis_Arg_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. sgn z = cis (arctan (Im z / Re z))
 2. - pi < arctan (Im z / Re z)
 3. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
show "sgn z = cis (arctan (Im z / Re z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn z = cis (arctan (Im z / Re z))
[PROOF STEP]
proof (rule complex_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2)
[PROOF STEP]
by (simp add: cos_arctan power_divide)
[PROOF STATE]
proof (state)
this:
Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2)

goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (cis (arctan (Im z / Re z))) = 1 / sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2)

goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. 1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2
[PROOF STEP]
by (simp add: cmod_def field_simps)
[PROOF STATE]
proof (state)
this:
1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2

goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2

goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "1 / sqrt \<dots> = Re z / norm z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2) = Re z / cmod z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. 1 / sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2) = Re z / cmod z
[PROOF STEP]
by (simp add: real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
1 / sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2) = Re z / cmod z

goal (2 subgoals):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
 2. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Re (cis (arctan (Im z / Re z))) = Re z / cmod z
[PROOF STEP]
show "Re (sgn z) = Re (cis (arctan (Im z / Re z)))"
[PROOF STATE]
proof (prove)
using this:
Re (cis (arctan (Im z / Re z))) = Re z / cmod z

goal (1 subgoal):
 1. Re (sgn z) = Re (cis (arctan (Im z / Re z)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (sgn z) = Re (cis (arctan (Im z / Re z)))

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2))
[PROOF STEP]
by (simp add: sin_arctan field_simps)
[PROOF STATE]
proof (state)
this:
Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2))

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Im (cis (arctan (Im z / Re z))) = Im z / (Re z * sqrt (1 + (Im z)\<^sup>2 / (Re z)\<^sup>2))

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "1 + Im z ^ 2 / Re z ^ 2 = norm z ^ 2 / Re z ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. 1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2
[PROOF STEP]
by (simp add: cmod_def field_simps)
[PROOF STATE]
proof (state)
this:
1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 + (Im z)\<^sup>2 / (Re z)\<^sup>2 = (cmod z)\<^sup>2 / (Re z)\<^sup>2

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
have "Im z / (Re z * sqrt \<dots>) = Im z / norm z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im z / (Re z * sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2)) = Im z / cmod z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re z

goal (1 subgoal):
 1. Im z / (Re z * sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2)) = Im z / cmod z
[PROOF STEP]
by (simp add: real_sqrt_divide)
[PROOF STATE]
proof (state)
this:
Im z / (Re z * sqrt ((cmod z)\<^sup>2 / (Re z)\<^sup>2)) = Im z / cmod z

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Im (cis (arctan (Im z / Re z))) = Im z / cmod z
[PROOF STEP]
show "Im (sgn z) = Im (cis (arctan (Im z / Re z)))"
[PROOF STATE]
proof (prove)
using this:
Im (cis (arctan (Im z / Re z))) = Im z / cmod z

goal (1 subgoal):
 1. Im (sgn z) = Im (cis (arctan (Im z / Re z)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (sgn z) = Im (cis (arctan (Im z / Re z)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sgn z = cis (arctan (Im z / Re z))

goal (2 subgoals):
 1. - pi < arctan (Im z / Re z)
 2. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - pi < arctan (Im z / Re z)
 2. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
show "arctan (Im z / Re z) > -pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi < arctan (Im z / Re z)
[PROOF STEP]
by (rule le_less_trans[OF _ arctan_lbound]) auto
[PROOF STATE]
proof (state)
this:
- pi < arctan (Im z / Re z)

goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
have "arctan (Im z / Re z) < pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (Im z / Re z) < pi / 2
[PROOF STEP]
by (rule arctan_ubound)
[PROOF STATE]
proof (state)
this:
arctan (Im z / Re z) < pi / 2

goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (Im z / Re z) < pi / 2

goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
have "\<dots> \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 2 \<le> pi
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pi / 2 \<le> pi

goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan (Im z / Re z) < pi
[PROOF STEP]
show "arctan (Im z / Re z) \<le> pi"
[PROOF STATE]
proof (prove)
using this:
arctan (Im z / Re z) < pi

goal (1 subgoal):
 1. arctan (Im z / Re z) \<le> pi
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
arctan (Im z / Re z) \<le> pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_nth_roots:
  assumes "c \<noteq> 0" "n > 0"
  shows   "card {z::complex. z ^ n = c} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
have "card {z. z ^ n = c} = card {z::complex. z ^ n = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {z. z ^ n = c} = card {z. z ^ n = 1}
[PROOF STEP]
by (rule sym, rule bij_betw_same_card, rule bij_betw_nth_root_unity) fact+
[PROOF STATE]
proof (state)
this:
card {z. z ^ n = c} = card {z. z ^ n = 1}

goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {z. z ^ n = c} = card {z. z ^ n = 1}

goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
have "\<dots> = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {z. z ^ n = 1} = n
[PROOF STEP]
by (rule card_roots_unity_eq) fact+
[PROOF STATE]
proof (state)
this:
card {z. z ^ n = 1} = n

goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {z. z ^ n = c} = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {z. z ^ n = c} = n

goal (1 subgoal):
 1. card {z. z ^ n = c} = n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {z. z ^ n = c} = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_sign_changes_smult:
  assumes "a > (0 :: 'a :: linordered_idom)"
  shows   "coeff_sign_changes (smult a p) = coeff_sign_changes p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_changes (coeffs (smult a p)) = sign_changes (coeffs p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0::'a) < a

goal (1 subgoal):
 1. sign_changes (coeffs (smult a p)) = sign_changes (coeffs p)
[PROOF STEP]
by (auto intro!: sign_changes_cong simp: sgn_mult coeffs_smult)


[STATEMENT]
lemma (in conditionally_complete_linorder) le_cSup_iff:
  assumes "A \<noteq> {}" "bdd_above A"
  shows "x \<le> Sup A \<longleftrightarrow> (\<forall>y<x. \<exists>a\<in>A. y < a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> Sup A) = (\<forall>y<x. \<exists>a\<in>A. y < a)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. \<lbrakk>x \<le> Sup A; y < x\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. y < a
 2. \<forall>y<x. \<exists>a\<in>A. y < a \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. \<lbrakk>x \<le> Sup A; y < x\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. y < a
 2. \<forall>y<x. \<exists>a\<in>A. y < a \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
assume "x \<le> Sup A" "y < x"
[PROOF STATE]
proof (state)
this:
x \<le> Sup A
y < x

goal (2 subgoals):
 1. \<And>y. \<lbrakk>x \<le> Sup A; y < x\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. y < a
 2. \<forall>y<x. \<exists>a\<in>A. y < a \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> Sup A
y < x
[PROOF STEP]
have "y < Sup A"
[PROOF STATE]
proof (prove)
using this:
x \<le> Sup A
y < x

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

goal (2 subgoals):
 1. \<And>y. \<lbrakk>x \<le> Sup A; y < x\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. y < a
 2. \<forall>y<x. \<exists>a\<in>A. y < a \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y < Sup A
[PROOF STEP]
show "\<exists>a\<in>A. y < a"
[PROOF STATE]
proof (prove)
using this:
y < Sup A

goal (1 subgoal):
 1. \<exists>a\<in>A. y < a
[PROOF STEP]
unfolding less_cSup_iff[OF assms]
[PROOF STATE]
proof (prove)
using this:
Bex A ((<) y)

goal (1 subgoal):
 1. \<exists>a\<in>A. y < a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>A. y < a

goal (1 subgoal):
 1. \<forall>y<x. \<exists>a\<in>A. y < a \<Longrightarrow> x \<le> Sup A
[PROOF STEP]
qed (auto elim!: allE[of _ "Sup A"] simp add: not_le[symmetric] cSup_upper assms)


[STATEMENT]
lemma NTT_gen_NTT_full_length:
  assumes "length numbers =n"
  shows "NTT_gen n numbers = NTT numbers"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NTT_gen n numbers = NTT numbers
[PROOF STEP]
unfolding NTT_gen_def ntt_gen_def NTT_def ntt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. \<Sum>j = 0..<length numbers. numbers ! j * \<omega> ^ (n div n * i * j)) [0..<length numbers] = map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<omega> ^ (i * j)) [0..<n]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length numbers = n

goal (1 subgoal):
 1. map (\<lambda>i. \<Sum>j = 0..<length numbers. numbers ! j * \<omega> ^ (n div n * i * j)) [0..<length numbers] = map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<omega> ^ (i * j)) [0..<n]
[PROOF STEP]
by simp


[STATEMENT]
lemma ceiling_less_cancel: "\<lceil>x\<rceil> < \<lceil>y\<rceil> \<Longrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>x\<rceil> < \<lceil>y\<rceil> \<Longrightarrow> x < y
[PROOF STEP]
by (auto simp add: not_le [symmetric] ceiling_mono)


[STATEMENT]
lemma tendsto_add_const_iff:
  "((\<lambda>x. c + f x :: 'a::topological_group_add) \<longlongrightarrow> c + d) F \<longleftrightarrow> (f \<longlongrightarrow> d) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
using tendsto_add[OF tendsto_const[of c], of f d]
    and tendsto_add[OF tendsto_const[of "-c"], of "\<lambda>x. c + f x" "c + d"]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> d) ?F \<Longrightarrow> ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F
((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F \<Longrightarrow> ((\<lambda>x. - c + (c + f x)) \<longlongrightarrow> - c + (c + d)) ?F

goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
by auto


[STATEMENT]
lemma register_Snd_register_Fst[simp]:
  assumes \<open>register F\<close>
  shows \<open>(F o Snd; F o Fst) = F o swap\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<circ> Snd;F \<circ> Fst) = F \<circ> swap
[PROOF STEP]
apply (rule tensor_extensionality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. preregister (F \<circ> Snd;F \<circ> Fst)
 2. preregister (F \<circ> swap)
 3. \<And>a b. (F \<circ> Snd;F \<circ> Fst) (a \<otimes>\<^sub>u b) = (F \<circ> swap) (a \<otimes>\<^sub>u b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
register F

goal (3 subgoals):
 1. preregister (F \<circ> Snd;F \<circ> Fst)
 2. preregister (F \<circ> swap)
 3. \<And>a b. (F \<circ> Snd;F \<circ> Fst) (a \<otimes>\<^sub>u b) = (F \<circ> swap) (a \<otimes>\<^sub>u b)
[PROOF STEP]
by (auto simp: register_pair_apply Fst_def Snd_def register_mult tensor_update_mult)


[STATEMENT]
lemma atUV_union[simp]: "
  atUV U V (c1+c2) \<longleftrightarrow>
  (
    (atUV U V c1) \<or>
    (atUV U V c2) \<or>
    (atU U c1 \<and> atU V c2) \<or>
    (atU V c1 \<and> atU U c2)
  )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atUV U V (c1 + c2) = (atUV U V c1 \<or> atUV U V c2 \<or> atU U c1 \<and> atU V c2 \<or> atU V c1 \<and> atU U c2)
[PROOF STEP]
apply (unfold atUV_def atU_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>su sv. {#su#} + {#sv#} \<subseteq># c1 + c2 \<and> atU_s U su \<and> atU_s V sv) = ((\<exists>su sv. {#su#} + {#sv#} \<subseteq># c1 \<and> atU_s U su \<and> atU_s V sv) \<or> (\<exists>su sv. {#su#} + {#sv#} \<subseteq># c2 \<and> atU_s U su \<and> atU_s V sv) \<or> (\<exists>s. s \<in># c1 \<and> atU_s U s) \<and> (\<exists>s. s \<in># c2 \<and> atU_s V s) \<or> (\<exists>s. s \<in># c1 \<and> atU_s V s) \<and> (\<exists>s. s \<in># c2 \<and> atU_s U s))
[PROOF STEP]
apply (auto elim!: mset_2dist2_cases intro: mset_le_incr_right iff add: mset_le_mono_add_single)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s sa. \<lbrakk>s \<in># c1; atU_s U s; sa \<in># c2; atU_s V sa\<rbrakk> \<Longrightarrow> \<exists>su sv. {#sv, su#} \<subseteq># c1 + c2 \<and> atU_s U su \<and> atU_s V sv
[PROOF STEP]
apply (subst union_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s sa. \<lbrakk>s \<in># c1; atU_s U s; sa \<in># c2; atU_s V sa\<rbrakk> \<Longrightarrow> \<exists>su sv. {#sv, su#} \<subseteq># c2 + c1 \<and> atU_s U su \<and> atU_s V sv
[PROOF STEP]
apply (auto iff add: mset_le_mono_add_single)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_laplace_add:
  assumes f: "(f has_laplace F) S"
  assumes g: "(g has_laplace G) S"
  shows "((\<lambda>x. f x + g x) has_laplace F + G) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x + g x) has_laplace F + G) S
[PROOF STEP]
apply (rule has_laplaceI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. exp (t *\<^sub>R - S) * (f t + g t)) has_integral F + G) {0..}
[PROOF STEP]
using has_integral_add[OF has_laplaceD[OF f ] has_laplaceD[OF g]]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (x *\<^sub>R - S) * f x + exp (x *\<^sub>R - S) * g x) has_integral F + G) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. exp (t *\<^sub>R - S) * (f t + g t)) has_integral F + G) {0..}
[PROOF STEP]
by (auto simp: algebra_simps)


[STATEMENT]
lemma tendsto_add_const_iff:
  \<comment> \<open>This is a generalization of \<open>Limits.tendsto_add_const_iff\<close>,
      the only difference is that the sort here is more general.\<close>
  "((\<lambda>x. c + f x :: 'a::topological_group_add) \<longlongrightarrow> c + d) F \<longleftrightarrow> (f \<longlongrightarrow> d) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
using tendsto_add[OF tendsto_const[of c], of f d]
    and tendsto_add[OF tendsto_const[of "-c"], of "\<lambda>x. c + f x" "c + d"]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> d) ?F \<Longrightarrow> ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F
((\<lambda>x. c + f x) \<longlongrightarrow> c + d) ?F \<Longrightarrow> ((\<lambda>x. - c + (c + f x)) \<longlongrightarrow> - c + (c + d)) ?F

goal (1 subgoal):
 1. ((\<lambda>x. c + f x) \<longlongrightarrow> c + d) F = (f \<longlongrightarrow> d) F
[PROOF STEP]
by auto


[STATEMENT]
lemma emeasure_join:
  assumes M[simp, measurable_cong]: "sets M = sets (subprob_algebra N)" and A: "A \<in> sets N"
  shows "emeasure (join M) A = (\<integral>\<^sup>+ M'. emeasure M' A \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (join M) A = \<integral>\<^sup>+ M'. emeasure M' A \<partial>M
[PROOF STEP]
proof (rule emeasure_measure_of[OF join_def])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. sets (select_sets M) \<subseteq> Pow (space (select_sets M))
 2. positive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)
 3. countably_additive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)
 4. A \<in> sets (join M)
[PROOF STEP]
show "countably_additive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countably_additive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)
[PROOF STEP]
proof (rule countably_additiveI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
fix A :: "nat \<Rightarrow> 'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
assume A: "range A \<subseteq> sets (join M)" "disjoint_family A"
[PROOF STATE]
proof (state)
this:
range A \<subseteq> sets (join M)
disjoint_family A

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
have "(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = (\<integral>\<^sup>+M'. (\<Sum>i. emeasure M' (A i)) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
range A \<subseteq> sets (join M)
disjoint_family A

goal (1 subgoal):
 1. (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M
[PROOF STEP]
by (subst nn_integral_suminf) (auto simp: measurable_emeasure_subprob_algebra)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+M'. emeasure M' (\<Union>i. A i) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
proof (rule nn_integral_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> (\<Sum>i. emeasure x (A i)) = emeasure x (\<Union> (range A))
[PROOF STEP]
fix M'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> (\<Sum>i. emeasure x (A i)) = emeasure x (\<Union> (range A))
[PROOF STEP]
assume "M' \<in> space M"
[PROOF STATE]
proof (state)
this:
M' \<in> space M

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> (\<Sum>i. emeasure x (A i)) = emeasure x (\<Union> (range A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M' \<in> space M
[PROOF STEP]
show "(\<Sum>i. emeasure M' (A i)) = emeasure M' (\<Union>i. A i)"
[PROOF STATE]
proof (prove)
using this:
M' \<in> space M

goal (1 subgoal):
 1. (\<Sum>i. emeasure M' (A i)) = emeasure M' (\<Union> (range A))
[PROOF STEP]
using A sets_eq_imp_space_eq[OF M]
[PROOF STATE]
proof (prove)
using this:
M' \<in> space M
range A \<subseteq> sets (join M)
disjoint_family A
space M = space (subprob_algebra N)

goal (1 subgoal):
 1. (\<Sum>i. emeasure M' (A i)) = emeasure M' (\<Union> (range A))
[PROOF STEP]
by (simp add: suminf_emeasure space_subprob_algebra)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure M' (A i)) = emeasure M' (\<Union> (range A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ M'. (\<Sum>i. emeasure M' (A i)) \<partial>M = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M

goal (1 subgoal):
 1. \<And>A. \<lbrakk>range A \<subseteq> sets (join M); disjoint_family A; \<Union> (range A) \<in> sets (join M)\<rbrakk> \<Longrightarrow> (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
show "(\<Sum>i. \<integral>\<^sup>+M'. emeasure M' (A i) \<partial>M) = (\<integral>\<^sup>+M'. emeasure M' (\<Union>i. A i) \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M

goal (1 subgoal):
 1. (\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i. \<integral>\<^sup>+ M'. emeasure M' (A i) \<partial>M) = \<integral>\<^sup>+ M'. emeasure M' (\<Union> (range A)) \<partial>M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
countably_additive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)

goal (3 subgoals):
 1. sets (select_sets M) \<subseteq> Pow (space (select_sets M))
 2. positive (sets (join M)) (\<lambda>B. \<integral>\<^sup>+ M'. emeasure M' B \<partial>M)
 3. A \<in> sets (join M)
[PROOF STEP]
qed (auto simp: A sets.space_closed positive_def)


[STATEMENT]
lemma asymptotics4: "eventually (\<lambda>x. (1 - (ln x powr (-e/2))) * 2 \<ge> 1) at_top"
  (is "eventually (\<lambda>x. ?f x \<ge> 1) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 \<le> (1 - ln x powr (- e / 2)) * 2
[PROOF STEP]
proof (rule eventually_mp[OF always_eventually], clarify)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. ?P x \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
 2. eventually ?P at_top
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have "(?f \<longlongrightarrow> 2) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. ((\<lambda>x. (1 - ln x powr (- e / 2)) * 2) \<longlongrightarrow> 2) at_top
[PROOF STEP]
by (force intro: tendsto_eq_intros tendsto_neg_powr ln_at_top)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (1 - ln x powr (- e / 2)) * 2) \<longlongrightarrow> 2) at_top

goal (2 subgoals):
 1. \<And>x. ?P x \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
 2. eventually ?P at_top
[PROOF STEP]
hence "\<And>e. e>0 \<Longrightarrow> eventually (\<lambda>x. \<bar>?f x - 2\<bar> < e) at_top"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (1 - ln x powr (- e / 2)) * 2) \<longlongrightarrow> 2) at_top

goal (1 subgoal):
 1. \<And>ea. 0 < ea \<Longrightarrow> \<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < ea
[PROOF STEP]
by (subst (asm) tendsto_iff) (simp add: dist_real_def)
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < ?e

goal (2 subgoals):
 1. \<And>x. ?P x \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
 2. eventually ?P at_top
[PROOF STEP]
from this[of 1]
[PROOF STATE]
proof (chain)
picking this:
0 < 1 \<Longrightarrow> \<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1
[PROOF STEP]
show "eventually (\<lambda>x. \<bar>?f x - 2\<bar> < 1) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> \<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1

goal (1 subgoal):
 1. \<And>x. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1 \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1 \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
[PROOF STEP]
assume "\<bar>?f x - 2\<bar> < 1"
[PROOF STATE]
proof (state)
this:
\<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1

goal (1 subgoal):
 1. \<And>x. \<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1 \<Longrightarrow> 1 \<le> (1 - ln x powr (- e / 2)) * 2
[PROOF STEP]
thus "?f x \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>(1 - ln x powr (- e / 2)) * 2 - 2\<bar> < 1

goal (1 subgoal):
 1. 1 \<le> (1 - ln x powr (- e / 2)) * 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> (1 - ln x powr (- e / 2)) * 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_r_part_sum: "(\<Sum>k\<le>m. (2 * m + 1 choose k)) = 2 ^ (2 * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "2 * 2^(2*m) = (\<Sum>k = 0..(2 * m + 1). (2 * m + 1 choose k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * 2 ^ (2 * m) = sum ((choose) (2 * m + 1)) {0..2 * m + 1}
[PROOF STEP]
using choose_row_sum[where n="2 * m + 1"]
[PROOF STATE]
proof (prove)
using this:
sum ((choose) (2 * m + 1)) {..2 * m + 1} = 2 ^ (2 * m + 1)

goal (1 subgoal):
 1. 2 * 2 ^ (2 * m) = sum ((choose) (2 * m + 1)) {0..2 * m + 1}
[PROOF STEP]
by (simp add: atMost_atLeast0)
[PROOF STATE]
proof (state)
this:
2 * 2 ^ (2 * m) = sum ((choose) (2 * m + 1)) {0..2 * m + 1}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * 2 ^ (2 * m) = sum ((choose) (2 * m + 1)) {0..2 * m + 1}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "(\<Sum>k = 0..(2 * m + 1). (2 * m + 1 choose k)) =
      (\<Sum>k = 0..m. (2 * m + 1 choose k)) +
      (\<Sum>k = m+1..2*m+1. (2 * m + 1 choose k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {0..2 * m + 1} = sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1}
[PROOF STEP]
using sum.ub_add_nat[of 0 m "\<lambda>k. 2 * m + 1 choose k" "m+1"]
[PROOF STATE]
proof (prove)
using this:
0 \<le> m + 1 \<Longrightarrow> sum ((choose) (2 * m + 1)) {0..m + (m + 1)} = sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {m + 1..m + (m + 1)}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {0..2 * m + 1} = sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1}
[PROOF STEP]
by (simp add: mult_2)
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {0..2 * m + 1} = sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {0..2 * m + 1} = sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "(\<Sum>k = m+1..2*m+1. (2 * m + 1 choose k)) =
      (\<Sum>k = 0..m. (2 * m + 1 choose (k + (m + 1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1} = (\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1)))
[PROOF STEP]
by (subst sum.shift_bounds_cl_nat_ivl [symmetric]) (simp add: mult_2)
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1} = (\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1)))

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {m + 1..2 * m + 1} = (\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1)))

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..m. (2 * m + 1 choose (m - k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1))) = (\<Sum>k = 0..m. 2 * m + 1 choose (m - k))
[PROOF STEP]
by (intro sum.cong[OF refl], subst binomial_symmetric) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1))) = (\<Sum>k = 0..m. 2 * m + 1 choose (m - k))

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..m. 2 * m + 1 choose (k + (m + 1))) = (\<Sum>k = 0..m. 2 * m + 1 choose (m - k))

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "\<dots> = (\<Sum>k = 0..m. (2 * m + 1 choose k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..m. 2 * m + 1 choose (m - k)) = sum ((choose) (2 * m + 1)) {0..m}
[PROOF STEP]
using sum.atLeastAtMost_rev [of "\<lambda>k. 2 * m + 1 choose (m - k)" 0 m]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..m. 2 * m + 1 choose (m - k)) = (\<Sum>i = 0..m. 2 * m + 1 choose (m - (m + 0 - i)))

goal (1 subgoal):
 1. (\<Sum>k = 0..m. 2 * m + 1 choose (m - k)) = sum ((choose) (2 * m + 1)) {0..m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..m. 2 * m + 1 choose (m - k)) = sum ((choose) (2 * m + 1)) {0..m}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..m. 2 * m + 1 choose (m - k)) = sum ((choose) (2 * m + 1)) {0..m}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
have "\<dots> + \<dots> = 2 * \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {0..m} = 2 * sum ((choose) (2 * m + 1)) {0..m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {0..m} + sum ((choose) (2 * m + 1)) {0..m} = 2 * sum ((choose) (2 * m + 1)) {0..m}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 * 2 ^ (2 * m) = 2 * sum ((choose) (2 * m + 1)) {0..m}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * 2 ^ (2 * m) = 2 * sum ((choose) (2 * m + 1)) {0..m}

goal (1 subgoal):
 1. sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)
[PROOF STEP]
by (subst (asm) mult_cancel1) (simp add: atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
sum ((choose) (2 * m + 1)) {..m} = 2 ^ (2 * m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_interlaced_seq:
  assumes "(\<lambda>n. of_rat (r n)) \<longlonglongrightarrow> (x::real)"
  and "(\<lambda>n. of_rat (s n)) \<longlonglongrightarrow> (x::real)"
  and "\<forall>n. of_rat (r n) < x"
  and "\<forall>n. of_rat (s n) < x"
  shows "convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
have mono: "monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
using assms incseq_interlaced_seq incseq_of_rat monoseq_iff
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x
(\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x
\<forall>n. real_of_rat (r n) < x
\<forall>n. real_of_rat (s n) < x
\<lbrakk>(\<lambda>n. real_of_rat (?r n)) \<longlonglongrightarrow> ?x; (\<lambda>n. real_of_rat (?s n)) \<longlonglongrightarrow> ?x; \<forall>n. real_of_rat (?r n) < ?x; \<forall>n. real_of_rat (?s n) < ?x\<rbrakk> \<Longrightarrow> incseq (interlaced_seq ?r ?s)
incseq ?s \<Longrightarrow> incseq (\<lambda>n. of_rat (?s n))
monoseq ?X = (incseq ?X \<or> decseq ?X)

goal (1 subgoal):
 1. monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
have "interlaced_seq r s 0 \<le> interlaced_seq r s n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s 0
 2. \<And>n. interlaced_seq r s 0 \<le> interlaced_seq r s n \<Longrightarrow> interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s 0
 2. \<And>n. interlaced_seq r s 0 \<le> interlaced_seq r s n \<Longrightarrow> interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s 0

goal (1 subgoal):
 1. \<And>n. interlaced_seq r s 0 \<le> interlaced_seq r s n \<Longrightarrow> interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. interlaced_seq r s 0 \<le> interlaced_seq r s n \<Longrightarrow> interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s n

goal (1 subgoal):
 1. \<And>n. interlaced_seq r s 0 \<le> interlaced_seq r s n \<Longrightarrow> interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interlaced_seq r s 0 \<le> interlaced_seq r s n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
interlaced_seq r s 0 \<le> interlaced_seq r s n

goal (1 subgoal):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
using assms incseq_def incseq_interlaced_seq
[PROOF STATE]
proof (prove)
using this:
interlaced_seq r s 0 \<le> interlaced_seq r s n
(\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x
(\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x
\<forall>n. real_of_rat (r n) < x
\<forall>n. real_of_rat (s n) < x
incseq ?X = (\<forall>m n. m \<le> n \<longrightarrow> ?X m \<le> ?X n)
\<lbrakk>(\<lambda>n. real_of_rat (?r n)) \<longlonglongrightarrow> ?x; (\<lambda>n. real_of_rat (?s n)) \<longlonglongrightarrow> ?x; \<forall>n. real_of_rat (?r n) < ?x; \<forall>n. real_of_rat (?s n) < ?x\<rbrakk> \<Longrightarrow> incseq (interlaced_seq ?r ?s)

goal (1 subgoal):
 1. interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s n

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s ?n2

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s ?n2

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
interlaced_seq r s 0 \<le> interlaced_seq r s ?n2

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
have "real_of_rat (interlaced_seq r s n) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (interlaced_seq r s n) \<le> x
[PROOF STEP]
by (simp add: assms(3,4) interlaced_seq_bounded le_less)
[PROOF STATE]
proof (state)
this:
real_of_rat (interlaced_seq r s n) \<le> x

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
real_of_rat (interlaced_seq r s ?n2) \<le> x

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
interlaced_seq r s 0 \<le> interlaced_seq r s ?n2
real_of_rat (interlaced_seq r s ?n2) \<le> x
[PROOF STEP]
have "Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))"
[PROOF STATE]
proof (prove)
using this:
interlaced_seq r s 0 \<le> interlaced_seq r s ?n2
real_of_rat (interlaced_seq r s ?n2) \<le> x

goal (1 subgoal):
 1. Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
by (metis decseq_bounded incseq_bounded mono monoseq_iff of_rat_less_eq)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
using mono
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>n. real_of_rat (interlaced_seq r s n))
monoseq (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal (1 subgoal):
 1. convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))
[PROOF STEP]
by (simp add: Bseq_monoseq_convergent)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. real_of_rat (interlaced_seq r s n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_summable_on_union [intro]:
  assumes "f abs_summable_on A" and "f abs_summable_on B"
  shows   "f abs_summable_on (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on A \<union> B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A
f abs_summable_on B

goal (1 subgoal):
 1. f abs_summable_on A \<union> B
[PROOF STEP]
unfolding abs_summable_on_altdef
[PROOF STATE]
proof (prove)
using this:
set_integrable (count_space UNIV) A f
set_integrable (count_space UNIV) B f

goal (1 subgoal):
 1. set_integrable (count_space UNIV) (A \<union> B) f
[PROOF STEP]
by (intro set_integrable_Un) auto


[STATEMENT]
lemma degree_poly_of_vec_less:
  fixes v :: "'a :: comm_monoid_add vec"
  assumes dim: "dim_vec v > 0"
  shows "degree (poly_of_vec v) < dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (poly_of_vec v) < dim_vec v
[PROOF STEP]
unfolding poly_of_vec_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Sum>i<dim_vec v. monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
apply(rule degree_sum_smaller)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < dim_vec v
 2. finite {..<dim_vec v}
 3. \<And>i. i \<in> {..<dim_vec v} \<Longrightarrow> degree (monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec v

goal (3 subgoals):
 1. 0 < dim_vec v
 2. finite {..<dim_vec v}
 3. \<And>i. i \<in> {..<dim_vec v} \<Longrightarrow> degree (monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {..<dim_vec v}
 2. \<And>i. i \<in> {..<dim_vec v} \<Longrightarrow> degree (monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<dim_vec v} \<Longrightarrow> degree (monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
unfolding lessThan_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < dim_vec v \<Longrightarrow> degree (monom (v $ (dim_vec v - Suc i)) i) < dim_vec v
[PROOF STEP]
by (metis degree_0 degree_monom_eq dim monom_eq_0_iff)


[STATEMENT]
lemma strict_monoI[intro?]:
  assumes "\<And>x y. x <\<^sub>a y \<Longrightarrow> f x <\<^sub>b f y"
  shows "strict_mono\<^sub>a\<^sub>b f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono\<^sub>a\<^sub>b f
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. x <\<^sub>a y \<longrightarrow> f x <\<^sub>b f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x <\<^sub>a ?y \<Longrightarrow> f ?x <\<^sub>b f ?y

goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. x <\<^sub>a y \<longrightarrow> f x <\<^sub>b f y
[PROOF STEP]
by simp


[STATEMENT]
lemma list_all_zip_alt: "list_all_zip P as bs \<longleftrightarrow> length as = length bs \<and> (\<forall>i<length as. P (as!i) (bs!i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all_zip P as bs = (length as = length bs \<and> (\<forall>i<length as. P (as ! i) (bs ! i)))
[PROOF STEP]
apply (induct P\<equiv>P as bs rule: list_all_zip.induct)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. list_all_zip P [] [] = (length [] = length [] \<and> (\<forall>i<length []. P ([] ! i) ([] ! i)))
 2. \<And>a as b bs. list_all_zip P as bs = (length as = length bs \<and> (\<forall>i<length as. P (as ! i) (bs ! i))) \<Longrightarrow> list_all_zip P (a # as) (b # bs) = (length (a # as) = length (b # bs) \<and> (\<forall>i<length (a # as). P ((a # as) ! i) ((b # bs) ! i)))
 3. \<And>v va. list_all_zip P (v # va) [] = (length (v # va) = length [] \<and> (\<forall>i<length (v # va). P ((v # va) ! i) ([] ! i)))
 4. \<And>v va. list_all_zip P [] (v # va) = (length [] = length (v # va) \<and> (\<forall>i<length []. P ([] ! i) ((v # va) ! i)))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a as b bs i. \<lbrakk>list_all_zip P as bs; P a b; length as = length bs; \<forall>i<length bs. P (as ! i) (bs ! i); i < Suc (length bs)\<rbrakk> \<Longrightarrow> P ((a # as) ! i) ((b # bs) ! i)
[PROOF STEP]
apply (case_tac i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a as b bs i. \<lbrakk>list_all_zip P as bs; P a b; length as = length bs; \<forall>i<length bs. P (as ! i) (bs ! i); i < Suc (length bs); i = 0\<rbrakk> \<Longrightarrow> P ((a # as) ! i) ((b # bs) ! i)
 2. \<And>a as b bs i nat. \<lbrakk>list_all_zip P as bs; P a b; length as = length bs; \<forall>i<length bs. P (as ! i) (bs ! i); i < Suc (length bs); i = Suc nat\<rbrakk> \<Longrightarrow> P ((a # as) ! i) ((b # bs) ! i)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_strict_mono:
  fixes A :: "nat set"
  assumes "finite B" "A \<subset> B" "0 \<notin> B"
  shows "\<Sum> A < \<Sum> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
have "B - A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A \<noteq> {}
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
A \<subset> B

goal (1 subgoal):
 1. B - A \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B - A \<noteq> {}

goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
with assms DiffE
[PROOF STATE]
proof (chain)
picking this:
finite B
A \<subset> B
0 \<notin> B
\<lbrakk>?c \<in> ?A - ?B; \<lbrakk>?c \<in> ?A; ?c \<notin> ?B\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
B - A \<noteq> {}
[PROOF STEP]
have "\<Sum> (B-A) > 0"
[PROOF STATE]
proof (prove)
using this:
finite B
A \<subset> B
0 \<notin> B
\<lbrakk>?c \<in> ?A - ?B; \<lbrakk>?c \<in> ?A; ?c \<notin> ?B\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
B - A \<noteq> {}

goal (1 subgoal):
 1. 0 < \<Sum> (B - A)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < \<Sum> (B - A)

goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < \<Sum> (B - A)

goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
have "\<Sum> B = \<Sum> A + \<Sum> (B-A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> B = \<Sum> A + \<Sum> (B - A)
[PROOF STEP]
by (metis add.commute assms(1) assms(2) psubsetE sum.subset_diff)
[PROOF STATE]
proof (state)
this:
\<Sum> B = \<Sum> A + \<Sum> (B - A)

goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < \<Sum> (B - A)
\<Sum> B = \<Sum> A + \<Sum> (B - A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < \<Sum> (B - A)
\<Sum> B = \<Sum> A + \<Sum> (B - A)

goal (1 subgoal):
 1. \<Sum> A < \<Sum> B
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<Sum> A < \<Sum> B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_le_1_if_pairwise_eq:
  assumes "\<forall>x \<in> S. \<forall>y \<in> S. x = y"
  shows "card S \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card S \<le> 1
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> card S \<le> 1 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> card S \<le> 1"
[PROOF STATE]
proof (state)
this:
\<not> card S \<le> 1

goal (1 subgoal):
 1. \<not> card S \<le> 1 \<Longrightarrow> False
[PROOF STEP]
hence "2 \<le> card S"
[PROOF STATE]
proof (prove)
using this:
\<not> card S \<le> 1

goal (1 subgoal):
 1. 2 \<le> card S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> card S

goal (1 subgoal):
 1. \<not> card S \<le> 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<le> card S
[PROOF STEP]
obtain T where *: "T \<subseteq> S \<and> card T = 2"
[PROOF STATE]
proof (prove)
using this:
2 \<le> card S

goal (1 subgoal):
 1. (\<And>T. T \<subseteq> S \<and> card T = 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_card
[PROOF STATE]
proof (prove)
using this:
2 \<le> card S
?n \<le> card ?A \<Longrightarrow> \<exists>S\<subseteq>?A. card S = ?n

goal (1 subgoal):
 1. (\<And>T. T \<subseteq> S \<and> card T = 2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
T \<subseteq> S \<and> card T = 2

goal (1 subgoal):
 1. \<not> card S \<le> 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<subseteq> S \<and> card T = 2
[PROOF STEP]
obtain x y where "x \<in> T \<and> y \<in> T \<and> x \<noteq> y"
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> S \<and> card T = 2

goal (1 subgoal):
 1. (\<And>x y. x \<in> T \<and> y \<in> T \<and> x \<noteq> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson card_2_iff')
[PROOF STATE]
proof (state)
this:
x \<in> T \<and> y \<in> T \<and> x \<noteq> y

goal (1 subgoal):
 1. \<not> card S \<le> 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> T \<and> y \<in> T \<and> x \<noteq> y
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x \<in> T \<and> y \<in> T \<and> x \<noteq> y

goal (1 subgoal):
 1. False
[PROOF STEP]
using * assms
[PROOF STATE]
proof (prove)
using this:
x \<in> T \<and> y \<in> T \<and> x \<noteq> y
T \<subseteq> S \<and> card T = 2
\<forall>x\<in>S. \<forall>y\<in>S. x = y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DERIV_log:
  assumes "x > 0"
  shows "DERIV (\<lambda>y. log b y) x :> 1 / (ln b * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
define lb where "lb = 1 / ln b"
[PROOF STATE]
proof (state)
this:
lb = 1 / ln b

goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
lb = 1 / ln b

goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
have "DERIV (\<lambda>y. lb * ln y) x :> lb / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>y. lb * ln y) has_real_derivative lb / x) (at x)
[PROOF STEP]
using \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. ((\<lambda>y. lb * ln y) has_real_derivative lb / x) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. lb * ln y) has_real_derivative lb / x) (at x)

goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lb = 1 / ln b
((\<lambda>y. lb * ln y) has_real_derivative lb / x) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lb = 1 / ln b
((\<lambda>y. lb * ln y) has_real_derivative lb / x) (at x)

goal (1 subgoal):
 1. (log b has_real_derivative 1 / (ln b * x)) (at x)
[PROOF STEP]
by (simp add: log_def)
[PROOF STATE]
proof (state)
this:
(log b has_real_derivative 1 / (ln b * x)) (at x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cnorm_eq_1: "norm x = 1 \<longleftrightarrow> cinner x x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x = 1) = (cinner x x = 1)
[PROOF STEP]
by (metis cinner_ge_zero complex_of_real_cmod norm_eq_sqrt_cinner norm_one of_real_1 real_sqrt_eq_iff real_sqrt_one)


[STATEMENT]
lemma prv_neg_eql_suc_Num_zer:
"prv (neg (eql (suc (Num n)) zer))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (neg (eql (suc (Num n)) zer))
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. prv (neg (eql (suc (Num 0)) zer))
 2. \<And>n. prv (neg (eql (suc (Num n)) zer)) \<Longrightarrow> prv (neg (eql (suc (Num (Suc n))) zer))
[PROOF STEP]
apply (metis Num Num.simps(1) Num_atrm eql fls in_num neg_def prv_eql_sym prv_neg_zer_suc prv_prv_imp_trans suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. prv (neg (eql (suc (Num n)) zer)) \<Longrightarrow> prv (neg (eql (suc (Num (Suc n))) zer))
[PROOF STEP]
by (metis Num_atrm atrm_imp_trm eql fls neg_def prv_eql_sym prv_neg_zer_suc prv_prv_imp_trans suc zer_atrm)


[STATEMENT]
lemma sum_count_vec_subset:  "finite A \<Longrightarrow> set\<^sub>v v \<subseteq> A \<Longrightarrow> (\<Sum> i \<in> A. count_vec v i) = dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; set\<^sub>v v \<subseteq> A\<rbrakk> \<Longrightarrow> sum (count_vec v) A = dim_vec v
[PROOF STEP]
using sum_setv_subset_eq sum_count_vec finite_subset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; set\<^sub>v ?v \<subseteq> ?A\<rbrakk> \<Longrightarrow> sum (count_vec ?v) (set\<^sub>v ?v) = sum (count_vec ?v) ?A
finite (set\<^sub>v ?v) \<Longrightarrow> sum (count_vec ?v) (set\<^sub>v ?v) = dim_vec ?v
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. \<lbrakk>finite A; set\<^sub>v v \<subseteq> A\<rbrakk> \<Longrightarrow> sum (count_vec v) A = dim_vec v
[PROOF STEP]
by metis


[STATEMENT]
lemma distinct_seteq_set_Cons_in_set:
  "\<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk>
    \<Longrightarrow> \<exists>y ys zs. y#ys = x \<and> y \<in> xs \<and> Finite_Set.card zs = n \<and> ys\<in>{ys. set ys = zs \<and> distinct ys}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = x \<and> y \<in> xs \<and> Finite_Set.card zs = n \<and> ys \<in> {ys. set ys = zs \<and> distinct ys}
[PROOF STEP]
using distinct_seteq_set_Cons''
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Finite_Set.card ?xs = Suc ?n; ?x \<in> {ys. set ys = ?xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = ?x \<and> y \<in> ?xs \<and> set ys = zs \<and> Finite_Set.card zs = ?n \<and> distinct ys \<and> finite zs

goal (1 subgoal):
 1. \<lbrakk>Finite_Set.card xs = Suc n; x \<in> {ys. set ys = xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys zs. y # ys = x \<and> y \<in> xs \<and> Finite_Set.card zs = n \<and> ys \<in> {ys. set ys = zs \<and> distinct ys}
[PROOF STEP]
by auto


[STATEMENT]
lemma incseq_sumI2:
  fixes f :: "'i \<Rightarrow> nat \<Rightarrow> 'a::ordered_comm_monoid_add"
  shows "(\<And>n. n \<in> A \<Longrightarrow> mono (f n)) \<Longrightarrow> mono (\<lambda>i. \<Sum>n\<in>A. f n i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n \<in> A \<Longrightarrow> incseq (f n)) \<Longrightarrow> incseq (\<lambda>i. \<Sum>n\<in>A. f n i)
[PROOF STEP]
unfolding incseq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n \<in> A \<Longrightarrow> \<forall>m na. m \<le> na \<longrightarrow> f n m \<le> f n na) \<Longrightarrow> \<forall>m n. m \<le> n \<longrightarrow> (\<Sum>n\<in>A. f n m) \<le> (\<Sum>na\<in>A. f na n)
[PROOF STEP]
by (auto intro: sum_mono)


[STATEMENT]
lemma projector_collapse_trace:
  assumes "projector (P::complex Matrix.mat)"
  and "P \<in> carrier_mat n n"
  and "R\<in> carrier_mat n n"
shows "Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
have "Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R)
[PROOF STEP]
using trace_comm assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (?A * ?B) = Complex_Matrix.trace (?B * ?A)
projector P
P \<in> carrier_mat n n
R \<in> carrier_mat n n

goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
have "... = Complex_Matrix.trace ((P * P) * R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (P * R) = Complex_Matrix.trace (P * P * R)
[PROOF STEP]
using assms projector_square_eq[of P]
[PROOF STATE]
proof (prove)
using this:
projector P
P \<in> carrier_mat n n
R \<in> carrier_mat n n
projector P \<Longrightarrow> P * P = P

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R) = Complex_Matrix.trace (P * P * R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * R) = Complex_Matrix.trace (P * P * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * R) = Complex_Matrix.trace (P * P * R)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
have "... = Complex_Matrix.trace (P * (P * R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (P * P * R) = Complex_Matrix.trace (P * (P * R))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
projector P
P \<in> carrier_mat n n
R \<in> carrier_mat n n

goal (1 subgoal):
 1. Complex_Matrix.trace (P * P * R) = Complex_Matrix.trace (P * (P * R))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * P * R) = Complex_Matrix.trace (P * (P * R))

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * P * R) = Complex_Matrix.trace (P * (P * R))

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
have "... = Complex_Matrix.trace (P * R * P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (P * (P * R)) = Complex_Matrix.trace (P * R * P)
[PROOF STEP]
using trace_comm[of P n "P * R"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>P \<in> carrier_mat n n; P * R \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> Complex_Matrix.trace (P * (P * R)) = Complex_Matrix.trace (P * R * P)
projector P
P \<in> carrier_mat n n
R \<in> carrier_mat n n

goal (1 subgoal):
 1. Complex_Matrix.trace (P * (P * R)) = Complex_Matrix.trace (P * R * P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * (P * R)) = Complex_Matrix.trace (P * R * P)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)
[PROOF STEP]
have "Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)

goal (1 subgoal):
 1. Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.trace (R * P) = Complex_Matrix.trace (P * R * P)

goal (1 subgoal):
 1. Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.trace (P * R * P) = Complex_Matrix.trace (R * P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_arg_max_cong:
  assumes "\<And>x. P x \<Longrightarrow> f x = g x"
  shows "is_arg_max f P x \<longleftrightarrow> is_arg_max g P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_arg_max f P x = is_arg_max g P x
[PROOF STEP]
unfolding is_arg_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P x \<and> (\<nexists>y. P y \<and> f x < f y)) = (P x \<and> (\<nexists>y. P y \<and> g x < g y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P ?x \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. (P x \<and> (\<nexists>y. P y \<and> f x < f y)) = (P x \<and> (\<nexists>y. P y \<and> g x < g y))
[PROOF STEP]
by auto


[STATEMENT]
lemma obtain_set_pred: assumes "(x::nat) > z " and "min_in_set A z" and "finite A"  shows "\<exists> y. is_pred_in_set A x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
have "{y \<in> A. y < x} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> A. y < x} \<noteq> {}
[PROOF STEP]
using assms(1) assms(2) min_in_set_def
[PROOF STATE]
proof (prove)
using this:
z < x
min_in_set A z
min_in_set ?xs ?x = (?x \<in> ?xs \<and> (\<forall>y\<in>?xs. ?x \<le> y))

goal (1 subgoal):
 1. {y \<in> A. y < x} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y \<in> A. y < x} \<noteq> {}

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
hence "Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}"
[PROOF STATE]
proof (prove)
using this:
{y \<in> A. y < x} \<noteq> {}

goal (1 subgoal):
 1. Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}
[PROOF STEP]
by (metis (full_types) Max_eq_iff finite_M_bounded_by_nat)
[PROOF STATE]
proof (state)
this:
Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
have "i \<in> A\<Longrightarrow> i < x \<Longrightarrow> i \<le> Max {y \<in> A. y < x} " for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<in> A; i < x\<rbrakk> \<Longrightarrow> i \<le> Max {y \<in> A. y < x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<in> A; ?i < x\<rbrakk> \<Longrightarrow> ?i \<le> Max {y \<in> A. y < x}

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}
\<lbrakk>?i \<in> A; ?i < x\<rbrakk> \<Longrightarrow> ?i \<le> Max {y \<in> A. y < x}
[PROOF STEP]
have "is_pred_in_set A x (Max {y \<in> A. y < x})"
[PROOF STATE]
proof (prove)
using this:
Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}
\<lbrakk>?i \<in> A; ?i < x\<rbrakk> \<Longrightarrow> ?i \<le> Max {y \<in> A. y < x}

goal (1 subgoal):
 1. is_pred_in_set A x (Max {y \<in> A. y < x})
[PROOF STEP]
using is_pred_in_set_def
[PROOF STATE]
proof (prove)
using this:
Max {y \<in> A. y < x} \<in> {y \<in> A. y < x}
\<lbrakk>?i \<in> A; ?i < x\<rbrakk> \<Longrightarrow> ?i \<le> Max {y \<in> A. y < x}
is_pred_in_set ?xs ?x ?y = (?y \<in> ?xs \<and> ?y < ?x \<and> (\<forall>z\<in>?xs. z < ?x \<longrightarrow> z \<le> ?y))

goal (1 subgoal):
 1. is_pred_in_set A x (Max {y \<in> A. y < x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_pred_in_set A x (Max {y \<in> A. y < x})

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_pred_in_set A x (Max {y \<in> A. y < x})
[PROOF STEP]
show?thesis
[PROOF STATE]
proof (prove)
using this:
is_pred_in_set A x (Max {y \<in> A. y < x})

goal (1 subgoal):
 1. \<exists>y. is_pred_in_set A x y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>y. is_pred_in_set A x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem not_convergent_harm: "\<not>convergent (harm :: nat \<Rightarrow> 'a :: real_normed_field)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
have "convergent (\<lambda>n. norm (harm n :: 'a)) \<longleftrightarrow>
            convergent (harm :: nat \<Rightarrow> real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. norm (harm n)) = convergent harm
[PROOF STEP]
by (simp add: norm_harm)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. norm (harm n)) = convergent harm

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. norm (harm n)) = convergent harm

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
have "\<dots> \<longleftrightarrow> convergent (\<lambda>n. \<Sum>k=Suc 0..Suc n. inverse (of_nat k) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent harm = convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k))
[PROOF STEP]
unfolding harm_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>k = 1..n. inverse (real k)) = convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k))
[PROOF STEP]
by (subst convergent_Suc_iff) simp_all
[PROOF STATE]
proof (state)
this:
convergent harm = convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent harm = convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
have "... \<longleftrightarrow> convergent (\<lambda>n. \<Sum>k\<le>n. inverse (of_nat (Suc k)) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k)) = convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k)))
[PROOF STEP]
by (subst sum.shift_bounds_cl_Suc_ivl) (simp add: atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k)) = convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k)))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k = Suc 0..Suc n. inverse (real k)) = convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k)))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
have "... \<longleftrightarrow> summable (\<lambda>n. inverse (of_nat n) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k))) = summable (\<lambda>n. inverse (real n))
[PROOF STEP]
by (subst summable_Suc_iff [symmetric]) (simp add: summable_iff_convergent')
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k))) = summable (\<lambda>n. inverse (real n))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k\<le>n. inverse (real (Suc k))) = summable (\<lambda>n. inverse (real n))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
have "\<not>..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> summable (\<lambda>n. inverse (real n))
[PROOF STEP]
by (rule not_summable_harmonic)
[PROOF STATE]
proof (state)
this:
\<not> summable (\<lambda>n. inverse (real n))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<not> convergent (\<lambda>n. norm (harm n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> convergent (\<lambda>n. norm (harm n))

goal (1 subgoal):
 1. \<not> convergent harm
[PROOF STEP]
by (blast dest: convergent_norm)
[PROOF STATE]
proof (state)
this:
\<not> convergent harm

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_integrable_add [simp]:
  assumes f: "f square_integrable S" and g: "g square_integrable S"
  shows "(\<lambda>x. f x + g x) square_integrable S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) square_integrable S
[PROOF STEP]
unfolding square_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> sets lebesgue \<and> (\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S) \<and> integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)
[PROOF STEP]
proof (intro conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. S \<in> sets lebesgue
 2. (\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S)
 3. integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)
[PROOF STEP]
show "S \<in> sets lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> sets lebesgue
[PROOF STEP]
using assms square_integrable_def
[PROOF STATE]
proof (prove)
using this:
f square_integrable S
g square_integrable S
?f square_integrable ?S \<equiv> ?S \<in> sets lebesgue \<and> ?f \<in> borel_measurable (lebesgue_on ?S) \<and> integrable (lebesgue_on ?S) (\<lambda>x. (?f x)\<^sup>2)

goal (1 subgoal):
 1. S \<in> sets lebesgue
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S \<in> sets lebesgue

goal (2 subgoals):
 1. (\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S)
 2. integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)
[PROOF STEP]
show "(\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S)
[PROOF STEP]
by (simp add: f g borel_measurable_add square_integrable_imp_measurable)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f x + g x) \<in> borel_measurable (lebesgue_on S)

goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)
[PROOF STEP]
show "integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)
[PROOF STEP]
unfolding power2_eq_square distrib_right distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * f x + g x * f x + (f x * g x + g x * g x))
[PROOF STEP]
proof (intro Bochner_Integration.integrable_add)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * f x)
 2. integrable (lebesgue_on S) (\<lambda>x. g x * f x)
 3. integrable (lebesgue_on S) (\<lambda>x. f x * g x)
 4. integrable (lebesgue_on S) (\<lambda>x. g x * g x)
[PROOF STEP]
show "integrable (lebesgue_on S) (\<lambda>x. f x * f x)" "integrable (lebesgue_on S) (\<lambda>x. g x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * f x) &&& integrable (lebesgue_on S) (\<lambda>x. g x * g x)
[PROOF STEP]
using f g square_integrable_imp_integrable_product
[PROOF STATE]
proof (prove)
using this:
f square_integrable S
g square_integrable S
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> integrable (lebesgue_on ?S) (\<lambda>x. ?f x * ?g x)

goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * f x) &&& integrable (lebesgue_on S) (\<lambda>x. g x * g x)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on S) (\<lambda>x. f x * f x)
integrable (lebesgue_on S) (\<lambda>x. g x * g x)

goal (2 subgoals):
 1. integrable (lebesgue_on S) (\<lambda>x. g x * f x)
 2. integrable (lebesgue_on S) (\<lambda>x. f x * g x)
[PROOF STEP]
show "integrable (lebesgue_on S) (\<lambda>x. f x * g x)" "integrable (lebesgue_on S) (\<lambda>x. g x * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * g x) &&& integrable (lebesgue_on S) (\<lambda>x. g x * f x)
[PROOF STEP]
using f g square_integrable_imp_integrable_product
[PROOF STATE]
proof (prove)
using this:
f square_integrable S
g square_integrable S
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> integrable (lebesgue_on ?S) (\<lambda>x. ?f x * ?g x)

goal (1 subgoal):
 1. integrable (lebesgue_on S) (\<lambda>x. f x * g x) &&& integrable (lebesgue_on S) (\<lambda>x. g x * f x)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on S) (\<lambda>x. f x * g x)
integrable (lebesgue_on S) (\<lambda>x. g x * f x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integrable (lebesgue_on S) (\<lambda>x. (f x + g x)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma int_of_uint32_0: "int_of_uint32 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_uint32 0 = 0
[PROOF STEP]
unfolding int_of_uint32_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma (in abelian_group) r_neg2:
  "\<lbrakk> x \<in> carrier G; y \<in> carrier G \<rbrakk> \<Longrightarrow> x \<oplus> ((\<ominus> x) \<oplus> y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<oplus> (\<ominus> x \<oplus> y) = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<oplus> (\<ominus> x \<oplus> y) = y
[PROOF STEP]
assume G: "x \<in> carrier G" "y \<in> carrier G"
[PROOF STATE]
proof (state)
this:
x \<in> carrier G
y \<in> carrier G

goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<oplus> (\<ominus> x \<oplus> y) = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
[PROOF STEP]
have "(x \<oplus> \<ominus> x) \<oplus> y = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G

goal (1 subgoal):
 1. x \<oplus> \<ominus> x \<oplus> y = y
[PROOF STEP]
by (simp only: r_neg l_zero)
[PROOF STATE]
proof (state)
this:
x \<oplus> \<ominus> x \<oplus> y = y

goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<oplus> (\<ominus> x \<oplus> y) = y
[PROOF STEP]
with G
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier G
y \<in> carrier G
x \<oplus> \<ominus> x \<oplus> y = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
y \<in> carrier G
x \<oplus> \<ominus> x \<oplus> y = y

goal (1 subgoal):
 1. x \<oplus> (\<ominus> x \<oplus> y) = y
[PROOF STEP]
by (simp add: a_ac)
[PROOF STATE]
proof (state)
this:
x \<oplus> (\<ominus> x \<oplus> y) = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_summable_harmonic: "\<not>summable (\<lambda>n. inverse (of_nat n) :: 'a :: real_normed_field)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> summable (\<lambda>n. inverse (of_nat n))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
assume "summable (\<lambda>n. inverse (of_nat n) :: 'a)"
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. inverse (of_nat n))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
hence "convergent (\<lambda>n. norm (of_real (\<Sum>k<n. inverse (of_nat k)) :: 'a))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. inverse (of_nat n))

goal (1 subgoal):
 1. convergent (\<lambda>n. norm (of_real (\<Sum>k<n. inverse (real k))))
[PROOF STEP]
by (simp add: summable_iff_convergent convergent_norm)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. norm (of_real (\<Sum>k<n. inverse (real k))))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
hence "convergent (\<lambda>n. abs (\<Sum>k<n. inverse (of_nat k)) :: real)"
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. norm (of_real (\<Sum>k<n. inverse (real k))))

goal (1 subgoal):
 1. convergent (\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>)
[PROOF STEP]
by (simp only: norm_of_real)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>)

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>)

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
have "(\<lambda>n. abs (\<Sum>k<n. inverse (of_nat k)) :: real) = (\<lambda>n. \<Sum>k<n. inverse (of_nat k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>) = (\<lambda>n. \<Sum>k<n. inverse (real k))
[PROOF STEP]
by (intro ext abs_of_nonneg sum_nonneg) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>) = (\<lambda>n. \<Sum>k<n. inverse (real k))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>\<Sum>k<n. inverse (real k)\<bar>) = (\<lambda>n. \<Sum>k<n. inverse (real k))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
have "convergent \<dots> \<longleftrightarrow> summable (\<lambda>k. inverse (of_nat k) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>k<n. inverse (real k)) = summable (\<lambda>k. inverse (real k))
[PROOF STEP]
by (simp add: summable_iff_convergent)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k<n. inverse (real k)) = summable (\<lambda>k. inverse (real k))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n)) \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>k. inverse (real k))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. inverse (real k))

goal (1 subgoal):
 1. False
[PROOF STEP]
using summable_real_powr_iff[of "-1"]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. inverse (real k))
summable (\<lambda>n. real n powr - 1) = (- 1 < - 1)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closedin_continuous_map_preimage_gen:
  assumes "continuous_map X Y f" "closedin X U" "closedin Y V"
  shows "closedin X {x \<in> U. f x \<in> V}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X {x \<in> U. f x \<in> V}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closedin X {x \<in> U. f x \<in> V}
[PROOF STEP]
have eq: "{x \<in> U. f x \<in> V} = U \<inter> {x \<in> topspace X. f x \<in> V}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> U. f x \<in> V} = U \<inter> {x \<in> topspace X. f x \<in> V}
[PROOF STEP]
using assms(2) closedin_def
[PROOF STATE]
proof (prove)
using this:
closedin X U
closedin ?U ?S = (?S \<subseteq> topspace ?U \<and> openin ?U (topspace ?U - ?S))

goal (1 subgoal):
 1. {x \<in> U. f x \<in> V} = U \<inter> {x \<in> topspace X. f x \<in> V}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
{x \<in> U. f x \<in> V} = U \<inter> {x \<in> topspace X. f x \<in> V}

goal (1 subgoal):
 1. closedin X {x \<in> U. f x \<in> V}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X {x \<in> U. f x \<in> V}
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin X (U \<inter> {x \<in> topspace X. f x \<in> V})
[PROOF STEP]
using assms closedin_continuous_map_preimage
[PROOF STATE]
proof (prove)
using this:
continuous_map X Y f
closedin X U
closedin Y V
\<lbrakk>continuous_map ?X ?Y ?f; closedin ?Y ?C\<rbrakk> \<Longrightarrow> closedin ?X {x \<in> topspace ?X. ?f x \<in> ?C}

goal (1 subgoal):
 1. closedin X (U \<inter> {x \<in> topspace X. f x \<in> V})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
closedin X {x \<in> U. f x \<in> V}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma samp_uni_plus_one_time_pad:
shows "map_spmf (\<lambda>b. (y + b) mod q) (sample_uniform q) = sample_uniform q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + b) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
using inj_uni_samp_plus surj_uni_samp_plus one_time_pad
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>b. (?y + b) mod ?q) {..<?q}
inj_on (\<lambda>b. (?y + b) mod ?q) {..<?q} \<Longrightarrow> (\<lambda>b. (?y + b) mod ?q) ` {..<?q} = {..<?q}
\<lbrakk>inj_on ?f {..<?q}; ?f ` {..<?q} = {..<?q}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform ?q) = sample_uniform ?q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. (y + b) mod q) (sample_uniform q) = sample_uniform q
[PROOF STEP]
by simp


[STATEMENT]
theorem "\<exists>(j::int). \<forall>i. j \<le> i \<longrightarrow> (\<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>j. \<forall>i\<ge>j. \<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i
[PROOF STEP]
by cooper


[STATEMENT]
lemma prime_odd_int: "prime p \<Longrightarrow> p > (2::int) \<Longrightarrow> odd p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; 2 < p\<rbrakk> \<Longrightarrow> odd p
[PROOF STEP]
by (intro prime_int_not_dvd) auto


[STATEMENT]
lemma card_minus_fMin:
  "s \<noteq> {||} \<Longrightarrow> card (fset s - {fMin s}) < card (fset s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<noteq> {||} \<Longrightarrow> card (fset s - {fMin s}) < card (fset s)
[PROOF STEP]
by (metis Min_in bot_fset.rep_eq card_Diff1_less fMin.F.rep_eq finite_fset fset_equiv)


[STATEMENT]
lemma frechet_derivative_sin:
  "frechet_derivative (\<lambda>x. sin (f x)) (at x) = (\<lambda>xa. frechet_derivative f (at x) xa * cos (f x))"
  if "f differentiable (at x)"
  for f::"_\<Rightarrow>real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (\<lambda>x. sin (f x)) (at x) = (\<lambda>xa. frechet_derivative f (at x) xa * cos (f x))
[PROOF STEP]
by (rule frechet_derivative_at'[OF has_derivative_sin[OF frechet_derivative_worksI[OF that]]])


[STATEMENT]
lemma left_null_space_orthogonal_complement_col_space_real:
  fixes A::"real^'cols::{finite, wellorder}^'rows::{finite, wellorder}"
  shows "left_null_space A = real_matrix.orthogonal_complement (col_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_null_space A = real_matrix.v.orthogonal_complement (col_space A)
[PROOF STEP]
using real_matrix.left_null_space_orthogonal_complement_col_space[of A]
[PROOF STATE]
proof (prove)
using this:
left_null_space A = real_matrix.v.orthogonal_complement (col_space (\<chi>i j. cnj_class.cnj (A $ i $ j)))

goal (1 subgoal):
 1. left_null_space A = real_matrix.v.orthogonal_complement (col_space A)
[PROOF STEP]
by (simp add: cnj_real_def vec_lambda_eta)


[STATEMENT]
lemma quasi_measure_preservingE:
  assumes "f \<in> quasi_measure_preserving M N"
  shows "f \<in> measurable M N"
        "\<And>A. A \<in> sets N \<Longrightarrow> (f -` A \<inter> space M \<in> null_sets M) = (A \<in> null_sets N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> (f -` A \<inter> space M \<in> null_sets M) = (A \<in> null_sets N))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> quasi_measure_preserving M N

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> (f -` A \<inter> space M \<in> null_sets M) = (A \<in> null_sets N))
[PROOF STEP]
unfolding quasi_measure_preserving_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> M \<rightarrow>\<^sub>M N. \<forall>A\<in>sets N. (f -` A \<inter> space M \<in> null_sets M) = (A \<in> null_sets N)}

goal (1 subgoal):
 1. f \<in> M \<rightarrow>\<^sub>M N &&& (\<And>A. A \<in> sets N \<Longrightarrow> (f -` A \<inter> space M \<in> null_sets M) = (A \<in> null_sets N))
[PROOF STEP]
by auto


[STATEMENT]
lemma Union_of_fin_supp_sets:
  fixes X::"('a set)"
  assumes fs: "fs TYPE('a) TYPE('x)"
  and     fi: "finite X"
  shows "finite (\<Union>x\<in>X. ((supp x)::'x set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union> (supp ` X))
[PROOF STEP]
using fi
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. finite (\<Union> (supp ` X))
[PROOF STEP]
by (induct, auto simp add: fs1[OF fs])


[STATEMENT]
lemma odd_smaller_b:
  assumes "odd b"
  shows "\<lfloor> real_of_int b / 2 \<rfloor> + \<lfloor> real_of_int b / 2 \<rfloor> < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real_of_int b / 2\<rfloor> + \<lfloor>real_of_int b / 2\<rfloor> < b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
odd b

goal (1 subgoal):
 1. \<lfloor>real_of_int b / 2\<rfloor> + \<lfloor>real_of_int b / 2\<rfloor> < b
[PROOF STEP]
by (smt (z3) floor_divide_of_int_eq odd_two_times_div_two_succ
  of_int_hom.hom_add of_int_hom.hom_one)


[STATEMENT]
lemma index_minus_mat[simp]:
  "i < dim_row B \<Longrightarrow> j < dim_col B \<Longrightarrow> (A - B) $$ (i,j) = A $$ (i,j) - B $$ (i,j)"
  "dim_row (A - B) = dim_row B" "dim_col (A - B) = dim_col B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row B; j < dim_col B\<rbrakk> \<Longrightarrow> (A - B) $$ (i, j) = A $$ (i, j) - B $$ (i, j)) &&& dim_row (A - B) = dim_row B &&& dim_col (A - B) = dim_col B
[PROOF STEP]
unfolding minus_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < dim_row B; j < dim_col B\<rbrakk> \<Longrightarrow> mat (dim_row B) (dim_col B) (\<lambda>ij. A $$ ij - B $$ ij) $$ (i, j) = A $$ (i, j) - B $$ (i, j)) &&& dim_row (mat (dim_row B) (dim_col B) (\<lambda>ij. A $$ ij - B $$ ij)) = dim_row B &&& dim_col (mat (dim_row B) (dim_col B) (\<lambda>ij. A $$ ij - B $$ ij)) = dim_col B
[PROOF STEP]
by auto


[STATEMENT]
lemma coeff_mult_0: "coeff (p * q) 0 = coeff p 0 * coeff q 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (p * q) 0 = coeff p 0 * coeff q 0
[PROOF STEP]
by (simp add: coeff_mult)


[STATEMENT]
lemma relImage_proj:
  assumes "equiv A R"
  shows "relImage R (proj R) \<subseteq> Id_on (A//R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relImage R (proj R) \<subseteq> Id_on (A // R)
[PROOF STEP]
unfolding relImage_def Id_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(proj R a1, proj R a2) |a1 a2. (a1, a2) \<in> R} \<subseteq> (\<Union>x\<in>A // R. {(x, x)})
[PROOF STEP]
using proj_iff[OF assms] equiv_class_eq_iff[OF assms]
[PROOF STATE]
proof (prove)
using this:
{?x, ?y} \<subseteq> A \<Longrightarrow> (proj R ?x = proj R ?y) = ((?x, ?y) \<in> R)
((?x, ?y) \<in> R) = (R `` {?x} = R `` {?y} \<and> ?x \<in> A \<and> ?y \<in> A)

goal (1 subgoal):
 1. {(proj R a1, proj R a2) |a1 a2. (a1, a2) \<in> R} \<subseteq> (\<Union>x\<in>A // R. {(x, x)})
[PROOF STEP]
by (auto simp: proj_preserves)


[STATEMENT]
lemma null_sets_point_measure_iff:
  "X \<in> null_sets (point_measure A f) \<longleftrightarrow> X \<subseteq> A \<and> (\<forall>x\<in>X. f x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<in> null_sets (point_measure A f)) = (X \<subseteq> A \<and> (\<forall>x\<in>X. f x = 0))
[PROOF STEP]
by (auto simp: AE_count_space null_sets_density_iff point_measure_def)


[STATEMENT]
lemma relation_inter:
  shows "{(x,y). P x y} \<inter> {(x,y). Q x y} = {(x,y). P x y \<and> Q x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). P x y} \<inter> {(x, y). Q x y} = {(x, y). P x y \<and> Q x y}
[PROOF STEP]
by blast


[STATEMENT]
theorem product_over_sum:
  "O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = (x \<otimes> y) \<oplus> (x \<otimes> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
assume antecedent: "O x y \<and> O x z"
[PROOF STATE]
proof (state)
this:
O x y \<and> O x z

goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
hence "P (x \<otimes> (y \<oplus> z))((x \<otimes> y) \<oplus> (x \<otimes> z))"
[PROOF STATE]
proof (prove)
using this:
O x y \<and> O x z

goal (1 subgoal):
 1. P (x \<otimes> (y \<oplus> z)) (x \<otimes> y \<oplus> x \<otimes> z)
[PROOF STEP]
by (rule product_over_sum_left)
[PROOF STATE]
proof (state)
this:
P (x \<otimes> (y \<oplus> z)) (x \<otimes> y \<oplus> x \<otimes> z)

goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P (x \<otimes> (y \<oplus> z)) (x \<otimes> y \<oplus> x \<otimes> z)

goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
have "P((x \<otimes> y) \<oplus> (x \<otimes> z))(x \<otimes> (y \<oplus> z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (x \<otimes> y \<oplus> x \<otimes> z) (x \<otimes> (y \<oplus> z))
[PROOF STEP]
using antecedent
[PROOF STATE]
proof (prove)
using this:
O x y \<and> O x z

goal (1 subgoal):
 1. P (x \<otimes> y \<oplus> x \<otimes> z) (x \<otimes> (y \<oplus> z))
[PROOF STEP]
by (rule product_over_sum_right)
[PROOF STATE]
proof (state)
this:
P (x \<otimes> y \<oplus> x \<otimes> z) (x \<otimes> (y \<oplus> z))

goal (1 subgoal):
 1. O x y \<and> O x z \<Longrightarrow> x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P (x \<otimes> (y \<oplus> z)) (x \<otimes> y \<oplus> x \<otimes> z)
P (x \<otimes> y \<oplus> x \<otimes> z) (x \<otimes> (y \<oplus> z))
[PROOF STEP]
show "x \<otimes> (y \<oplus> z) = (x \<otimes> y) \<oplus> (x \<otimes> z)"
[PROOF STATE]
proof (prove)
using this:
P (x \<otimes> (y \<oplus> z)) (x \<otimes> y \<oplus> x \<otimes> z)
P (x \<otimes> y \<oplus> x \<otimes> z) (x \<otimes> (y \<oplus> z))

goal (1 subgoal):
 1. x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z
[PROOF STEP]
by (rule part_antisymmetry)
[PROOF STATE]
proof (state)
this:
x \<otimes> (y \<oplus> z) = x \<otimes> y \<oplus> x \<otimes> z

goal:
No subgoals!
[PROOF STEP]
qed