[STATEMENT]
lemma Mignotte_bound:
  shows "of_int \<bar>coeff g k\<bar> \<le> (degree g choose k) * mahler_measure g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
proof (cases "k \<le> degree g \<and> g \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
 2. \<not> (k \<le> degree g \<and> g \<noteq> 0) \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (k \<le> degree g \<and> g \<noteq> 0)

goal (2 subgoals):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
 2. \<not> (k \<le> degree g \<and> g \<noteq> 0) \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
hence "coeff g k = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (k \<le> degree g \<and> g \<noteq> 0)

goal (1 subgoal):
 1. poly.coeff g k = 0
[PROOF STEP]
using le_degree
[PROOF STATE]
proof (prove)
using this:
\<not> (k \<le> degree g \<and> g \<noteq> 0)
poly.coeff ?p ?n \<noteq> (0::?'a) \<Longrightarrow> ?n \<le> degree ?p

goal (1 subgoal):
 1. poly.coeff g k = 0
[PROOF STEP]
by (cases "g = 0", auto)
[PROOF STATE]
proof (state)
this:
poly.coeff g k = 0

goal (2 subgoals):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
 2. \<not> (k \<le> degree g \<and> g \<noteq> 0) \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
poly.coeff g k = 0

goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
using mahler_measure_ge_0[of g]
[PROOF STATE]
proof (prove)
using this:
poly.coeff g k = 0
0 \<le> mahler_measure g

goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
case kg: True
[PROOF STATE]
proof (state)
this:
k \<le> degree g \<and> g \<noteq> 0

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
hence g: "g \<noteq> 0" "g dvd g"
[PROOF STATE]
proof (prove)
using this:
k \<le> degree g \<and> g \<noteq> 0

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

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
from mignotte_bound_main[OF g le_refl, of k]
[PROOF STATE]
proof (chain)
picking this:
\<bar>poly.coeff g k\<bar> \<le> \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>
[PROOF STEP]
have "real_of_int \<bar>coeff g k\<bar>
    \<le> of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> +
      of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>)"
[PROOF STATE]
proof (prove)
using this:
\<bar>poly.coeff g k\<bar> \<le> \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>

goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff g k\<bar> \<le> real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>)

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>)

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
have "\<dots> \<le> real (degree g - 1 choose k) * mahler_measure g
     + real (min k 1 * (degree g - 1 choose (k - 1))) * (of_int \<bar>lead_coeff g\<bar> * 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1)
[PROOF STEP]
by (rule add_mono, force, auto)
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1)

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>real (degree g - 1 choose k) * mahler_measure g\<rfloor> + real_of_int (int (min k 1 * (degree g - 1 choose (k - 1))) * \<bar>lead_coeff g\<bar>) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1)

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
have "\<dots> \<le> real (degree g - 1 choose k) * mahler_measure g
     + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g
[PROOF STEP]
by (rule add_left_mono[OF mult_left_mono],
    unfold mahler_measure_def mahler_measure_poly_def,
    rule mult_mono, auto intro!: prod_list_ge1)
[PROOF STATE]
proof (state)
this:
real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * (real_of_int \<bar>lead_coeff g\<bar> * 1) \<le> real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
have "\<dots> =
    (real ((degree g - 1 choose k) + (min k 1 * (degree g - 1 choose (k - 1))))) * mahler_measure g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g = real (degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g = real (degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (degree g - 1 choose k) * mahler_measure g + real (min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g = real (degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1))) * mahler_measure g

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
have "(degree g - 1 choose k) + (min k 1 * (degree g - 1 choose (k - 1))) = degree g choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
proof (cases "k = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
 2. k \<noteq> 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
k \<noteq> 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
 2. k \<noteq> 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 0
[PROOF STEP]
obtain kk where k: "k = Suc kk"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0

goal (1 subgoal):
 1. (\<And>kk. k = Suc kk \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases k, auto)
[PROOF STATE]
proof (state)
this:
k = Suc kk

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
 2. k \<noteq> 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
with kg
[PROOF STATE]
proof (chain)
picking this:
k \<le> degree g \<and> g \<noteq> 0
k = Suc kk
[PROOF STEP]
obtain gg where g: "degree g = Suc gg"
[PROOF STATE]
proof (prove)
using this:
k \<le> degree g \<and> g \<noteq> 0
k = Suc kk

goal (1 subgoal):
 1. (\<And>gg. degree g = Suc gg \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "degree g", auto)
[PROOF STATE]
proof (state)
this:
degree g = Suc gg

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
 2. k \<noteq> 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
unfolding k g
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc gg - 1 choose Suc kk + min (Suc kk) 1 * (Suc gg - 1 choose (Suc kk - 1)) = Suc gg choose Suc kk
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k

goal (1 subgoal):
 1. k = 0 \<Longrightarrow> degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
degree g - 1 choose k + min k 1 * (degree g - 1 choose (k - 1)) = degree g choose k

goal (1 subgoal):
 1. k \<le> degree g \<and> g \<noteq> 0 \<Longrightarrow> real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g

goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>poly.coeff g k\<bar> \<le> real (degree g choose k) * mahler_measure g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_abs_converges_imp_converges [dest, intro]:
  "fds_abs_converges f s \<Longrightarrow> fds_converges f s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges f s \<Longrightarrow> fds_converges f s
[PROOF STEP]
unfolding fds_abs_converges_def fds_converges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (fds_nth f n / nat_power n s)) \<Longrightarrow> summable (\<lambda>n. fds_nth f n / nat_power n s)
[PROOF STEP]
by (rule summable_norm_cancel)


[STATEMENT]
lemma iMin_equality: "
  \<lbrakk> k \<in> I; \<And>x. x \<in> I \<Longrightarrow> k \<le> x \<rbrakk> \<Longrightarrow> iMin I = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; \<And>x. x \<in> I \<Longrightarrow> k \<le> x\<rbrakk> \<Longrightarrow> iMin I = k
[PROOF STEP]
unfolding iMin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> I; \<And>x. x \<in> I \<Longrightarrow> k \<le> x\<rbrakk> \<Longrightarrow> (LEAST x. x \<in> I) = k
[PROOF STEP]
by (blast intro: Least_equality)


[STATEMENT]
lemma takefill_bintrunc: "takefill False n bl = rev (bin_to_bl n (bl_to_bin (rev bl)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. takefill False n bl = rev (bin_to_bl n (bl_to_bin (rev bl)))
[PROOF STEP]
apply (rule nth_equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (takefill False n bl) = length (rev (bin_to_bl n (bl_to_bin (rev bl))))
 2. \<And>i. i < length (takefill False n bl) \<Longrightarrow> takefill False n bl ! i = rev (bin_to_bl n (bl_to_bin (rev bl))) ! i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length (takefill False n bl) \<Longrightarrow> takefill False n bl ! i = rev (bin_to_bl n (bl_to_bin (rev bl))) ! i
[PROOF STEP]
apply (clarsimp simp: nth_takefill rev_nth nth_bin_to_bl bin_nth_of_bl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Pbij_inverse_Dom: "Pbij_Dom \<beta> = Pbij_Rng (Pbij_inverse \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pbij_Dom \<beta> = Pbij_Rng (Pbij_inverse \<beta>)
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pbij_Dom \<beta> = Pbij_Rng (Pbij_inverse \<beta>)
[PROOF STEP]
by (simp add: Pbij_inverse_def Pbij_Dom_def Pbij_Rng_def)


[STATEMENT]
lemma lm035:
  assumes "a^-1 \<in> injections (Range a) N" "Range a \<in> all_partitions G"
  shows "a \<in> allAllocations N G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
using assms image_iff
[PROOF STATE]
proof (prove)
using this:
a\<inverse> \<in> injections (Range a) N
Range a \<in> all_partitions G
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
by fastforce


[STATEMENT]
lemma closed_Collect_eq:
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space"
  assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g"
  shows "closed {x. f x = g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. f x = g x}
[PROOF STEP]
using open_Collect_neq[OF f g]
[PROOF STATE]
proof (prove)
using this:
open {x. f x \<noteq> g x}

goal (1 subgoal):
 1. closed {x. f x = g x}
[PROOF STEP]
by (simp add: closed_def Collect_neg_eq)


[STATEMENT]
lemma cong_3_swap:
  assumes "A B C Cong3 A' B' C'"
  shows "B A C Cong3 B' A' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B A C Cong3 B' A' C'
[PROOF STEP]
using assms Cong3_def cong_commutativity
[PROOF STATE]
proof (prove)
using this:
A B C Cong3 A' B' C'
?A ?B ?C Cong3 ?A' ?B' ?C' \<equiv> Cong ?A ?B ?A' ?B' \<and> Cong ?A ?C ?A' ?C' \<and> Cong ?B ?C ?B' ?C'
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?B ?A ?D ?C

goal (1 subgoal):
 1. B A C Cong3 B' A' C'
[PROOF STEP]
by blast


[STATEMENT]
lemma components_eq_sing_exists: "(\<exists>a. components s = {a}) \<longleftrightarrow> connected s \<and> s \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a. components s = {a}) = (connected s \<and> s \<noteq> {})
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>a. components s = {a} \<Longrightarrow> connected s \<and> s \<noteq> {}
 2. connected s \<and> s \<noteq> {} \<Longrightarrow> \<exists>a. components s = {a}
[PROOF STEP]
using connected_eq_connected_components_eq
[PROOF STATE]
proof (prove)
using this:
connected ?s = (\<forall>c\<in>components ?s. \<forall>c'\<in>components ?s. c = c')

goal (2 subgoals):
 1. \<exists>a. components s = {a} \<Longrightarrow> connected s \<and> s \<noteq> {}
 2. connected s \<and> s \<noteq> {} \<Longrightarrow> \<exists>a. components s = {a}
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected s \<and> s \<noteq> {} \<Longrightarrow> \<exists>a. components s = {a}
[PROOF STEP]
apply (metis components_eq_sing_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma efficient_power_correct:
  assumes "\<And>x z. f x (f x z) = f (f x x) z"
  shows   "efficient_power y x n = (f x ^^ n) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.efficient_power y x n = (f x ^^ n) y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.efficient_power y x n = (f x ^^ n) y
[PROOF STEP]
have [simp]: "f ^^ 2 = (\<lambda>x. f (f x))" for f :: "'a \<Rightarrow> 'a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ^^ 2 = (\<lambda>x. f (f x))
[PROOF STEP]
by (simp add: eval_nat_numeral o_def)
[PROOF STATE]
proof (state)
this:
?f ^^ 2 = (\<lambda>x. ?f (?f x))

goal (1 subgoal):
 1. local.efficient_power y x n = (f x ^^ n) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.efficient_power y x n = (f x ^^ n) y
[PROOF STEP]
by (induction y x n rule: efficient_power.induct)
       (auto elim!: evenE oddE simp: funpow_mult [symmetric] funpow_Suc_right assms
             simp del: funpow.simps(2))
[PROOF STATE]
proof (state)
this:
local.efficient_power y x n = (f x ^^ n) y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trace_concat[simp]:
 "(\<forall>xs \<in> set xss. deltas d xs i = i) \<Longrightarrow>
  trace d i (concat xss) = concat (map (trace d i) xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs\<in>set xss. deltas d xs i = i \<Longrightarrow> trace d i (concat xss) = concat (map (trace d i) xss)
[PROOF STEP]
by (induct "xss") simp_all


[STATEMENT]
lemma tagged_division_of_union_self:
  assumes "p tagged_division_of s"
  shows "p tagged_division_of (\<Union>(snd ` p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p tagged_division_of \<Union> (snd ` p)
[PROOF STEP]
apply (rule tagged_division_ofI)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. finite p
 2. \<And>x K. (x, K) \<in> p \<Longrightarrow> x \<in> K
 3. \<And>x K. (x, K) \<in> p \<Longrightarrow> K \<subseteq> \<Union> (snd ` p)
 4. \<And>x K. (x, K) \<in> p \<Longrightarrow> \<exists>a b. K = cbox a b
 5. \<And>x1 K1 x2 K2. \<lbrakk>(x1, K1) \<in> p; (x2, K2) \<in> p; (x1, K1) \<noteq> (x2, K2)\<rbrakk> \<Longrightarrow> interior K1 \<inter> interior K2 = {}
 6. \<Union> {K. \<exists>x. (x, K) \<in> p} = \<Union> (snd ` p)
[PROOF STEP]
using tagged_division_ofD[OF assms]
[PROOF STATE]
proof (prove)
using this:
finite p
(?x, ?K) \<in> p \<Longrightarrow> ?x \<in> ?K
(?x, ?K) \<in> p \<Longrightarrow> ?K \<subseteq> s
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
\<lbrakk>(?x1.0, ?K1.0) \<in> p; (?x2.0, ?K2.0) \<in> p; (?x1.0, ?K1.0) \<noteq> (?x2.0, ?K2.0)\<rbrakk> \<Longrightarrow> interior ?K1.0 \<inter> interior ?K2.0 = {}
\<Union> {K. \<exists>x. (x, K) \<in> p} = s

goal (6 subgoals):
 1. finite p
 2. \<And>x K. (x, K) \<in> p \<Longrightarrow> x \<in> K
 3. \<And>x K. (x, K) \<in> p \<Longrightarrow> K \<subseteq> \<Union> (snd ` p)
 4. \<And>x K. (x, K) \<in> p \<Longrightarrow> \<exists>a b. K = cbox a b
 5. \<And>x1 K1 x2 K2. \<lbrakk>(x1, K1) \<in> p; (x2, K2) \<in> p; (x1, K1) \<noteq> (x2, K2)\<rbrakk> \<Longrightarrow> interior K1 \<inter> interior K2 = {}
 6. \<Union> {K. \<exists>x. (x, K) \<in> p} = \<Union> (snd ` p)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vcpower_index_vempty[simp]: "A ^\<^sub>\<times> 0 = set {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ^\<^sub>\<times> 0 = set {0}
[PROOF STEP]
unfolding vcpower_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>0. A) = set {0}
[PROOF STEP]
by (rule vproduct_index_vempty)


[STATEMENT]
lemma prod_ereal: "(\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
 2. infinite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
 2. infinite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
by induct (auto simp: one_ereal_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. (\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)
[PROOF STEP]
by (simp add: one_ereal_def)
[PROOF STATE]
proof (state)
this:
(\<Prod>i\<in>A. ereal (f i)) = ereal (prod f A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma div_poly_eq_0_iff:
  \<open>x div y = 0 \<longleftrightarrow> x = 0 \<or> y = 0 \<or> degree x < degree y\<close> for x y :: \<open>'a::field poly\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x div y = 0) = (x = 0 \<or> y = 0 \<or> degree x < degree y)
[PROOF STEP]
by (simp add: unique_euclidean_semiring_class.div_eq_0_iff euclidean_size_poly_def)


[STATEMENT]
lemma \<alpha>_limit_set_closed:
  shows "closed (\<alpha>_limit_set x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (\<alpha>_limit_set x)
[PROOF STEP]
unfolding \<alpha>_limit_set_eq_rev
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (rev.\<omega>_limit_set x)
[PROOF STEP]
by (rule rev.\<omega>_limit_set_closed)


[STATEMENT]
lemma (in vectorspace) sum_is_subspace:
  fixes W1 W2
  assumes h1: "subspace K W1 V" and h2: "subspace K W2 V"
  shows "subspace K (subspace_sum W1 W2) V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace K (subspace_sum W1 W2) V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subspace K (subspace_sum W1 W2) V
[PROOF STEP]
from h1 h2
[PROOF STATE]
proof (chain)
picking this:
subspace K W1 V
subspace K W2 V
[PROOF STEP]
have mod: "submodule K (submodule_sum W1 W2) V"
[PROOF STATE]
proof (prove)
using this:
subspace K W1 V
subspace K W2 V

goal (1 subgoal):
 1. LinearCombinations.submodule K (subspace_sum W1 W2) V
[PROOF STEP]
by ( intro sum_is_submodule, unfold subspace_def, auto)
[PROOF STATE]
proof (state)
this:
LinearCombinations.submodule K (subspace_sum W1 W2) V

goal (1 subgoal):
 1. subspace K (subspace_sum W1 W2) V
[PROOF STEP]
from mod h1 h2
[PROOF STATE]
proof (chain)
picking this:
LinearCombinations.submodule K (subspace_sum W1 W2) V
subspace K W1 V
subspace K W2 V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LinearCombinations.submodule K (subspace_sum W1 W2) V
subspace K W1 V
subspace K W2 V

goal (1 subgoal):
 1. subspace K (subspace_sum W1 W2) V
[PROOF STEP]
by (unfold subspace_def, auto)
[PROOF STATE]
proof (state)
this:
subspace K (subspace_sum W1 W2) V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UNION_bij_betw_ofilter:
assumes WELL: "Well_order r" and
        OF: "\<And> i. i \<in> I \<Longrightarrow> ofilter r (A i)" and
       BIJ: "\<And> i. i \<in> I \<Longrightarrow> bij_betw f (A i) (A' i)"
shows "bij_betw f (\<Union>i \<in> I. A i) (\<Union>i \<in> I. A' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))
[PROOF STEP]
have "wo_rel r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wo_rel r
[PROOF STEP]
using WELL
[PROOF STATE]
proof (prove)
using this:
Well_order r

goal (1 subgoal):
 1. wo_rel r
[PROOF STEP]
by (simp add: wo_rel_def)
[PROOF STATE]
proof (state)
this:
wo_rel r

goal (1 subgoal):
 1. bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))
[PROOF STEP]
hence "\<And> i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<le> A j \<or> A j \<le> A i"
[PROOF STATE]
proof (prove)
using this:
wo_rel r

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<subseteq> A j \<or> A j \<subseteq> A i
[PROOF STEP]
using wo_rel.ofilter_linord[of r] OF
[PROOF STATE]
proof (prove)
using this:
wo_rel r
\<lbrakk>wo_rel r; ofilter r ?A; ofilter r ?B\<rbrakk> \<Longrightarrow> ?A \<subseteq> ?B \<or> ?B \<subseteq> ?A
?i \<in> I \<Longrightarrow> ofilter r (A ?i)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> A i \<subseteq> A j \<or> A j \<subseteq> A i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i \<in> I; ?j \<in> I\<rbrakk> \<Longrightarrow> A ?i \<subseteq> A ?j \<or> A ?j \<subseteq> A ?i

goal (1 subgoal):
 1. bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))
[PROOF STEP]
with WELL BIJ
[PROOF STATE]
proof (chain)
picking this:
Well_order r
?i \<in> I \<Longrightarrow> bij_betw f (A ?i) (A' ?i)
\<lbrakk>?i \<in> I; ?j \<in> I\<rbrakk> \<Longrightarrow> A ?i \<subseteq> A ?j \<or> A ?j \<subseteq> A ?i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Well_order r
?i \<in> I \<Longrightarrow> bij_betw f (A ?i) (A' ?i)
\<lbrakk>?i \<in> I; ?j \<in> I\<rbrakk> \<Longrightarrow> A ?i \<subseteq> A ?j \<or> A ?j \<subseteq> A ?i

goal (1 subgoal):
 1. bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))
[PROOF STEP]
by (auto simp add: bij_betw_UNION_chain)
[PROOF STATE]
proof (state)
this:
bij_betw f (\<Union> (A ` I)) (\<Union> (A' ` I))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arctan_inverse:
  assumes "x \<noteq> 0"
  shows "arctan (1 / x) = sgn x * pi/2 - arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (1 / x) = sgn x * pi / 2 - arctan x
[PROOF STEP]
proof (rule arctan_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - (pi / 2) < sgn x * pi / 2 - arctan x
 2. sgn x * pi / 2 - arctan x < pi / 2
 3. tan (sgn x * pi / 2 - arctan x) = 1 / x
[PROOF STEP]
have \<section>: "x > 0 \<Longrightarrow> arctan x < pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> arctan x < pi
[PROOF STEP]
using arctan_bounded [of x]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan x \<and> arctan x < pi / 2

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> arctan x < pi
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < x \<Longrightarrow> arctan x < pi

goal (3 subgoals):
 1. - (pi / 2) < sgn x * pi / 2 - arctan x
 2. sgn x * pi / 2 - arctan x < pi / 2
 3. tan (sgn x * pi / 2 - arctan x) = 1 / x
[PROOF STEP]
show "- (pi/2) < sgn x * pi/2 - arctan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < sgn x * pi / 2 - arctan x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. - (pi / 2) < sgn x * pi / 2 - arctan x
[PROOF STEP]
by (auto simp: sgn_real_def arctan algebra_simps \<section>)
[PROOF STATE]
proof (state)
this:
- (pi / 2) < sgn x * pi / 2 - arctan x

goal (2 subgoals):
 1. sgn x * pi / 2 - arctan x < pi / 2
 2. tan (sgn x * pi / 2 - arctan x) = 1 / x
[PROOF STEP]
show "sgn x * pi/2 - arctan x < pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn x * pi / 2 - arctan x < pi / 2
[PROOF STEP]
using arctan_bounded [of "- x"] assms
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan (- x) \<and> arctan (- x) < pi / 2
x \<noteq> 0

goal (1 subgoal):
 1. sgn x * pi / 2 - arctan x < pi / 2
[PROOF STEP]
by (auto simp: algebra_simps sgn_real_def arctan_minus)
[PROOF STATE]
proof (state)
this:
sgn x * pi / 2 - arctan x < pi / 2

goal (1 subgoal):
 1. tan (sgn x * pi / 2 - arctan x) = 1 / x
[PROOF STEP]
show "tan (sgn x * pi/2 - arctan x) = 1 / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (sgn x * pi / 2 - arctan x) = 1 / x
[PROOF STEP]
unfolding tan_inverse [of "arctan x", unfolded tan_arctan] sgn_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan ((if x = 0 then 0 else if 0 < x then 1 else - 1) * pi / 2 - arctan x) = tan (pi / 2 - arctan x)
[PROOF STEP]
by (simp add: tan_def cos_arctan sin_arctan sin_diff cos_diff)
[PROOF STATE]
proof (state)
this:
tan (sgn x * pi / 2 - arctan x) = 1 / x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reduction_doesnt_break_things_invertibility_step1:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  assumes len_eq: "length subsets = length signs"
  assumes inv: "invertible_mat (matrix_A signs subsets)"
  assumes nonzero: "p \<noteq> 0"
  assumes welldefined_signs1: "well_def_signs (length qs) signs"
  assumes distinct_signs: "distinct signs"
  assumes all_info: "set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set(signs)"
  assumes match: "satisfy_equation p qs subsets signs"
  shows "vec_space.rank (length signs) (reduce_mat_cols (matrix_A signs subsets) (solve_for_lhs p qs subsets (matrix_A signs subsets))) =
    (length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
let ?og_mat = "(matrix_A signs subsets)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
let ?lhs = "(solve_for_lhs p qs subsets ?og_mat)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
let ?new_mat = "(take_rows_from_matrix (reduce_mat_cols ?og_mat ?lhs) (rows_to_keep (reduce_mat_cols ?og_mat ?lhs)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have "square_mat (matrix_A signs subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (M_mat signs subsets)
[PROOF STEP]
using inv
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat signs subsets)

goal (1 subgoal):
 1. square_mat (M_mat signs subsets)
[PROOF STEP]
using invertible_mat_def
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat signs subsets)
invertible_mat ?A \<equiv> square_mat ?A \<and> (\<exists>B. inverts_mat ?A B \<and> inverts_mat B ?A)

goal (1 subgoal):
 1. square_mat (M_mat signs subsets)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
square_mat (M_mat signs subsets)

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
square_mat (M_mat signs subsets)
[PROOF STEP]
have mat_size: "?og_mat \<in> carrier_mat (length signs) (length signs)"
[PROOF STATE]
proof (prove)
using this:
square_mat (M_mat signs subsets)

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
using size_of_mat
[PROOF STATE]
proof (prove)
using this:
square_mat (M_mat signs subsets)
M_mat ?signs ?subsets \<in> carrier_mat (length ?subsets) (length ?signs)

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
[PROOF STEP]
have mat_size_alt: "?og_mat \<in> carrier_mat (length subsets) (length subsets)"
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length subsets) (length subsets)
[PROOF STEP]
using size_of_mat same_size assms
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
M_mat ?signs ?subsets \<in> carrier_mat (length ?subsets) (length ?signs)
invertible_mat (M_mat ?signs ?subsets) \<Longrightarrow> length ?subsets = length ?signs
length subsets = length signs
invertible_mat (M_mat signs subsets)
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs

goal (1 subgoal):
 1. M_mat signs subsets \<in> carrier_mat (length subsets) (length subsets)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M_mat signs subsets \<in> carrier_mat (length subsets) (length subsets)

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have det_h: "det ?og_mat \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (M_mat signs subsets) \<noteq> 0
[PROOF STEP]
using invertible_det[where A = "matrix_A signs subsets"] mat_size
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat ?n ?n \<Longrightarrow> invertible_mat (M_mat signs subsets) = (det (M_mat signs subsets) \<noteq> 0)
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. det (M_mat signs subsets) \<noteq> 0
[PROOF STEP]
using inv
[PROOF STATE]
proof (prove)
using this:
M_mat signs subsets \<in> carrier_mat ?n ?n \<Longrightarrow> invertible_mat (M_mat signs subsets) = (det (M_mat signs subsets) \<noteq> 0)
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
invertible_mat (M_mat signs subsets)

goal (1 subgoal):
 1. det (M_mat signs subsets) \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
det (M_mat signs subsets) \<noteq> 0

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
det (M_mat signs subsets) \<noteq> 0
[PROOF STEP]
have rank_h: "vec_space.rank (length signs) ?og_mat = (length signs)"
[PROOF STATE]
proof (prove)
using this:
det (M_mat signs subsets) \<noteq> 0

goal (1 subgoal):
 1. vec_space.rank (length signs) (M_mat signs subsets) = length signs
[PROOF STEP]
using vec_space.det_rank_iff  mat_size
[PROOF STATE]
proof (prove)
using this:
det (M_mat signs subsets) \<noteq> 0
?A \<in> carrier_mat ?n ?n \<Longrightarrow> (det ?A \<noteq> (0::?'a)) = (vec_space.rank ?n ?A = ?n)
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)

goal (1 subgoal):
 1. vec_space.rank (length signs) (M_mat signs subsets) = length signs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_space.rank (length signs) (M_mat signs subsets) = length signs

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec_space.rank (length signs) (M_mat signs subsets) = length signs
[PROOF STEP]
have dist_cols: "distinct (cols ?og_mat)"
[PROOF STATE]
proof (prove)
using this:
vec_space.rank (length signs) (M_mat signs subsets) = length signs

goal (1 subgoal):
 1. distinct (cols (M_mat signs subsets))
[PROOF STEP]
using mat_size vec_space.non_distinct_low_rank[where A = ?og_mat, where n = "length signs"]
[PROOF STATE]
proof (prove)
using this:
vec_space.rank (length signs) (M_mat signs subsets) = length signs
M_mat signs subsets \<in> carrier_mat (length signs) (length signs)
\<lbrakk>M_mat signs subsets \<in> carrier_mat (length signs) (length signs); \<not> distinct (cols (M_mat signs subsets))\<rbrakk> \<Longrightarrow> vec_space.rank (length signs) (M_mat signs subsets) < length signs

goal (1 subgoal):
 1. distinct (cols (M_mat signs subsets))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (cols (M_mat signs subsets))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have well_def: "(\<And>j. j \<in> set (find_nonzeros_from_input_vec
                    (solve_for_lhs p qs subsets (matrix_A signs subsets))) \<Longrightarrow>
          j < length (cols (matrix_A signs subsets)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> j < length (cols (M_mat signs subsets))
[PROOF STEP]
using assms well_def_find_zeros_from_lhs_vec
[PROOF STATE]
proof (prove)
using this:
length subsets = length signs
invertible_mat (M_mat signs subsets)
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
\<lbrakk>length ?subsets = length ?signs; invertible_mat (M_mat ?signs ?subsets); ?p \<noteq> 0; well_def_signs (length ?qs) ?signs; distinct ?signs; set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs; satisfy_equation ?p ?qs ?subsets ?signs; ?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs ?p ?qs ?subsets (M_mat ?signs ?subsets)))\<rbrakk> \<Longrightarrow> ?j < length (cols (M_mat ?signs ?subsets))

goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> j < length (cols (M_mat signs subsets))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> ?j < length (cols (M_mat signs subsets))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have dist1: "distinct
     (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
unfolding find_nonzeros_from_input_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (filter (\<lambda>i. solve_for_lhs p qs subsets (M_mat signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs p qs subsets (M_mat signs subsets))])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
have clear: "set (take_indices (cols (matrix_A signs subsets))
          (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))
    \<subseteq> set (cols (matrix_A signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))
[PROOF STEP]
using assms take_cols_subsets_og_cols
[PROOF STATE]
proof (prove)
using this:
length subsets = length signs
invertible_mat (M_mat signs subsets)
p \<noteq> 0
well_def_signs (length qs) signs
distinct signs
set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs
satisfy_equation p qs subsets signs
\<lbrakk>length ?subsets = length ?signs; invertible_mat (M_mat ?signs ?subsets); ?p \<noteq> 0; well_def_signs (length ?qs) ?signs; distinct ?signs; set (characterize_consistent_signs_at_roots_copr ?p ?qs) \<subseteq> set ?signs; satisfy_equation ?p ?qs ?subsets ?signs\<rbrakk> \<Longrightarrow> set (take_indices (cols (M_mat ?signs ?subsets)) (find_nonzeros_from_input_vec (solve_for_lhs ?p ?qs ?subsets (M_mat ?signs ?subsets)))) \<subseteq> set (cols (M_mat ?signs ?subsets))

goal (1 subgoal):
 1. set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))
[PROOF STEP]
have "distinct (take_indices (cols (matrix_A signs subsets))
          (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))"
[PROOF STATE]
proof (prove)
using this:
set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))

goal (1 subgoal):
 1. distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))
[PROOF STEP]
unfolding take_indices_def
[PROOF STATE]
proof (prove)
using this:
set (map ((!) (cols (M_mat signs subsets))) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))

goal (1 subgoal):
 1. distinct (map ((!) (cols (M_mat signs subsets))) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))
[PROOF STEP]
using dist1 dist_cols well_def conjugatable_vec_space.distinct_map_nth[where ls = "cols (matrix_A signs subsets)", where inds = "(find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets)))"]
[PROOF STATE]
proof (prove)
using this:
set (map ((!) (cols (M_mat signs subsets))) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))
distinct (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
distinct (cols (M_mat signs subsets))
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> ?j < length (cols (M_mat signs subsets))
\<lbrakk>distinct (cols (M_mat signs subsets)); distinct (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> j < length (cols (M_mat signs subsets))\<rbrakk> \<Longrightarrow> distinct (map ((!) (cols (M_mat signs subsets))) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))

goal (1 subgoal):
 1. distinct (map ((!) (cols (M_mat signs subsets))) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))
[PROOF STEP]
have unfold_thesis: "vec_space.rank (length signs) (mat_of_cols (dim_row ?og_mat) (take_indices (cols ?og_mat) (find_nonzeros_from_input_vec ?lhs)))
= (length (find_nonzeros_from_input_vec ?lhs))"
[PROOF STATE]
proof (prove)
using this:
distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))

goal (1 subgoal):
 1. vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
using clear inv conjugatable_vec_space.rank_invertible_subset_cols[where A= "matrix_A signs subsets", where B = "(take_indices (cols (matrix_A signs subsets))
         (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (matrix_A signs subsets))))"]
[PROOF STATE]
proof (prove)
using this:
distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))
set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets))
invertible_mat (M_mat signs subsets)
\<lbrakk>invertible_mat (M_mat signs subsets); M_mat signs subsets \<in> carrier_mat ?n ?n; set (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) \<subseteq> set (cols (M_mat signs subsets)); distinct (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))\<rbrakk> \<Longrightarrow> vec_space.rank ?n (mat_of_cols ?n (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))

goal (1 subgoal):
 1. vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
by (simp add: len_eq mat_size take_indices_def)
[PROOF STATE]
proof (state)
this:
vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal (1 subgoal):
 1. vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank (length signs) (mat_of_cols (length subsets) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> vec_space.rank (length signs) (take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
unfolding take_cols_from_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank (length signs) (mat_of_cols (length subsets) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))) \<Longrightarrow> vec_space.rank (length signs) (mat_of_cols (dim_row (M_mat signs subsets)) (take_indices (cols (M_mat signs subsets)) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_space.rank (length signs) (reduce_mat_cols (M_mat signs subsets) (solve_for_lhs p qs subsets (M_mat signs subsets))) = length (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Qp_int_nat_pow_pow:
  fixes n::int
  fixes m::nat
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "(a[^](n*m)) = ((a[^]n)[^]m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a [^] (n * int m) = (a [^] n) [^] m
[PROOF STEP]
by (simp add: Qp_int_pow_pow assms int_pow_int)


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


[STATEMENT]
lemma bernoulli_Suc':
  "bernoulli (Suc n) = -1/(real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
have "bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k)
[PROOF STEP]
unfolding bernoulli.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k)

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k)

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
have "(\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k) =
               (\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k) = (\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k))
[PROOF STEP]
by (rule sum.reindex_bij_witness[of _ "\<lambda>k. n - k" "\<lambda>k. n - k"]) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k) = (\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k))

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. real (n + 2 choose k) * bernoulli k) = (\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k))

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
have "\<dots> = (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k)) = (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
by (intro sum.cong refl, subst binomial_symmetric) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. real (n + 2 choose (n - k)) * bernoulli (n - k)) = (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))

goal (1 subgoal):
 1. bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bernoulli (Suc n) = - 1 / (real n + 2) * (\<Sum>k\<le>n. real (n + 2 choose (k + 2)) * bernoulli (n - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_subcls1: "finite (subcls1 G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (subcls1 G)
[PROOF STEP]
apply (subst subcls1_def2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (SIGMA C:{C. is_class G C}. {D. C \<noteq> Object \<and> super (the (class G C)) = D})
[PROOF STEP]
apply (rule finite_SigmaI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {C. is_class G C}
 2. \<And>C. C \<in> {C. is_class G C} \<Longrightarrow> finite {D. C \<noteq> Object \<and> super (the (class G C)) = D}
[PROOF STEP]
apply (rule finite_is_class)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C. C \<in> {C. is_class G C} \<Longrightarrow> finite {D. C \<noteq> Object \<and> super (the (class G C)) = D}
[PROOF STEP]
apply (rule_tac B = "{super (the (class G C))}" in finite_subset)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>C. C \<in> {C. is_class G C} \<Longrightarrow> {D. C \<noteq> Object \<and> super (the (class G C)) = D} \<subseteq> {super (the (class G C))}
 2. \<And>C. C \<in> {C. is_class G C} \<Longrightarrow> finite {super (the (class G C))}
[PROOF STEP]
apply  auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_1: "f 1 = f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (1::'a) = f (0::'a)
[PROOF STEP]
using plus_of_nat[of 0 1]
[PROOF STATE]
proof (prove)
using this:
f ((0::'a) + of_nat 1) = f (0::'a)

goal (1 subgoal):
 1. f (1::'a) = f (0::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma is_pole_tendsto:
  fixes f::"('a::topological_space \<Rightarrow> 'b::real_normed_div_algebra)"
  shows "is_pole f x \<Longrightarrow> ((inverse o f) \<longlongrightarrow> 0) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_pole f x \<Longrightarrow> (inverse \<circ> f) \<midarrow>x\<rightarrow> (0::'b)
[PROOF STEP]
unfolding is_pole_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f at_infinity (at x) \<Longrightarrow> (inverse \<circ> f) \<midarrow>x\<rightarrow> (0::'b)
[PROOF STEP]
by (auto simp add:filterlim_inverse_at_iff[symmetric] comp_def filterlim_at)


[STATEMENT]
lemma heap_ordered_single:
"heap_ordered t = (\<forall>x \<in> set_mset (tree_to_multiset t). prio t \<le> snd x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. heap_ordered t = (\<forall>x\<in>#tree_to_multiset t. prio t \<le> snd x)
[PROOF STEP]
by (cases t) auto


[STATEMENT]
lemma Afix_cong[fundef_cong]:
  "\<lbrakk> (\<And> e. e \<in> snd ` set heap2 \<Longrightarrow> aexp1 e = aexp2 e); heap1 = heap2 \<rbrakk>
      \<Longrightarrow> ArityAnalysis.Afix aexp1 heap1 = ArityAnalysis.Afix aexp2 heap2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>e. e \<in> snd ` set heap2 \<Longrightarrow> aexp1 e = aexp2 e; heap1 = heap2\<rbrakk> \<Longrightarrow> ArityAnalysis.Afix aexp1 heap1 = ArityAnalysis.Afix aexp2 heap2
[PROOF STEP]
unfolding ArityAnalysis.Afix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>e. e \<in> snd ` set heap2 \<Longrightarrow> aexp1 e = aexp2 e; heap1 = heap2\<rbrakk> \<Longrightarrow> (\<Lambda> ae. \<mu> x. ArityAnalysis.ABinds aexp1 heap1\<cdot>x \<squnion> ae) = (\<Lambda> ae. \<mu> x. ArityAnalysis.ABinds aexp2 heap2\<cdot>x \<squnion> ae)
[PROOF STEP]
by (metis Abinds_cong)


[STATEMENT]
lemma (in domain) trivial_ker_imp_transcendental:
  assumes "subring K R" and "x \<in> carrier R"
  shows "a_kernel (K[X]) R (\<lambda>p. eval p x) = { [] } \<Longrightarrow> (transcendental over K) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a_kernel (K [X]) R (\<lambda>p. local.eval p x) = {[]} \<Longrightarrow> (transcendental over K) x
[PROOF STEP]
using ring_hom_ring.trivial_ker_imp_inj[OF eval_ring_hom[OF assms]]
[PROOF STATE]
proof (prove)
using this:
a_kernel (K [X]) R (\<lambda>p. local.eval p x) = {\<zero>\<^bsub>K [X]\<^esub>} \<Longrightarrow> inj_on (\<lambda>p. local.eval p x) (carrier (K [X]))

goal (1 subgoal):
 1. a_kernel (K [X]) R (\<lambda>p. local.eval p x) = {[]} \<Longrightarrow> (transcendental over K) x
[PROOF STEP]
unfolding transcendental_def over_def
[PROOF STATE]
proof (prove)
using this:
a_kernel (K [X]) R (\<lambda>p. local.eval p x) = {\<zero>\<^bsub>K [X]\<^esub>} \<Longrightarrow> inj_on (\<lambda>p. local.eval p x) (carrier (K [X]))

goal (1 subgoal):
 1. a_kernel (K [X]) R (\<lambda>p. local.eval p x) = {[]} \<Longrightarrow> inj_on (\<lambda>p. local.eval p x) (carrier (K [X]))
[PROOF STEP]
by (simp add: univ_poly_zero)


[STATEMENT]
lemma infsum_swap_banach:
  fixes A :: "'a set" and B :: "'b set"
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::banach"
  assumes \<open>(\<lambda>(x, y). f x y) summable_on (A \<times> B)\<close>
  shows "infsum (\<lambda>x. infsum (\<lambda>y. f x y) B) A = infsum (\<lambda>y. infsum (\<lambda>x. f x y) A) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
have [simp]: \<open>(\<lambda>(x, y). f y x) summable_on (B \<times> A)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f y x) summable_on B \<times> A
[PROOF STEP]
apply (subst product_swap[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f y x) summable_on prod.swap ` (A \<times> B)
[PROOF STEP]
apply (subst summable_on_reindex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on prod.swap (A \<times> B)
 2. (\<lambda>(x, y). f y x) \<circ> prod.swap summable_on A \<times> B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f x y) summable_on A \<times> B

goal (2 subgoals):
 1. inj_on prod.swap (A \<times> B)
 2. (\<lambda>(x, y). f y x) \<circ> prod.swap summable_on A \<times> B
[PROOF STEP]
by (auto simp: o_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). f y x) summable_on B \<times> A

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
have \<open>infsum (\<lambda>x. infsum (\<lambda>y. f x y) B) A = infsum (\<lambda>(x,y). f x y) (A \<times> B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y)
[PROOF STEP]
apply (subst infsum_Sigma'_banach)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>(x, y). f x y) summable_on A \<times> B
 2. (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f x y) summable_on A \<times> B

goal (2 subgoals):
 1. (\<lambda>(x, y). f x y) summable_on A \<times> B
 2. (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
have \<open>\<dots> = infsum (\<lambda>(x,y). f y x) (B \<times> A)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
apply (subst product_swap[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>(x, y)\<in>prod.swap ` (B \<times> A). f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
apply (subst infsum_reindex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on prod.swap (B \<times> A)
 2. infsum ((\<lambda>(x, y). f x y) \<circ> prod.swap) (B \<times> A) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f x y) summable_on A \<times> B

goal (2 subgoals):
 1. inj_on prod.swap (B \<times> A)
 2. infsum ((\<lambda>(x, y). f x y) \<circ> prod.swap) (B \<times> A) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
by (auto simp: o_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>(x, y)\<in>A \<times> B. f x y) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
have \<open>\<dots> = infsum (\<lambda>y. infsum (\<lambda>x. f x y) A) B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
apply (subst infsum_Sigma'_banach)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>(x, y). f y x) summable_on B \<times> A
 2. (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). f x y) summable_on A \<times> B

goal (2 subgoals):
 1. (\<lambda>(x, y). f y x) summable_on B \<times> A
 2. (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x) = (\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>(x, y)\<in>B \<times> A. f y x) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)

goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>\<infinity>x\<in>A. infsum (f x) B) = (\<Sum>\<^sub>\<infinity>y\<in>B. \<Sum>\<^sub>\<infinity>x\<in>A. f x y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_pow_int: "x ^ n = pow_int x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n = pow_int x (int n)
[PROOF STEP]
unfolding pow_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n = (if int n < 0 then (1::'a) / x ^ nat (- int n) else x ^ nat (int n))
[PROOF STEP]
by auto


[STATEMENT]
lemma of_nat_word_less_iff:
  \<open>of_nat m < (of_nat n :: 'a::len word) \<longleftrightarrow> take_bit LENGTH('a) m < take_bit LENGTH('a) n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_nat m < word_of_nat n) = (take_bit LENGTH('a) m < take_bit LENGTH('a) n)
[PROOF STEP]
by transfer (simp add: take_bit_of_nat)


[STATEMENT]
lemma coprime_preserves: "coprime (#V :: 'p mod_ring poly) (#W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_mult_class.coprime (#(#v + Polynomial.smult (of_nat q) (#v'))) (#(#w + Polynomial.smult (of_nat q) (#w')))
[PROOF STEP]
apply (intro coprimeI,simp add: rebase_q_to_p.of_nat_CARD_eq_0[simplified] hom_distribs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r. \<lbrakk>r dvd #v; r dvd #w\<rbrakk> \<Longrightarrow> r \<noteq> 0 \<and> degree r = 0
[PROOF STEP]
using coprime
[PROOF STATE]
proof (prove)
using this:
comm_monoid_mult_class.coprime (#v) (#w)

goal (1 subgoal):
 1. \<And>r. \<lbrakk>r dvd #v; r dvd #w\<rbrakk> \<Longrightarrow> r \<noteq> 0 \<and> degree r = 0
[PROOF STEP]
by (elim coprimeE, auto)


[STATEMENT]
lemma "(\<forall>x y. \<exists>z. \<forall>w. (P(x)\<and>Q(y)\<longrightarrow>R(z)\<and>S(w)))
    \<longrightarrow> (\<exists>x y. P(x) \<and> Q(y)) \<longrightarrow> (\<exists>z. R(z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. \<exists>z. \<forall>w. P x \<and> Q y \<longrightarrow> R z \<and> S w) \<longrightarrow> (\<exists>x y. P x \<and> Q y) \<longrightarrow> (\<exists>z. R z)
[PROOF STEP]
by blast


[STATEMENT]
lemma multiset_add_filter_size: "size {# a \<in># (A1 + A2) . P a #} = size {# a \<in># A1 . P a #} +
    size {# a \<in># A2 . P a #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (filter_mset P (A1 + A2)) = size (filter_mset P A1) + size (filter_mset P A2)
[PROOF STEP]
by simp


[STATEMENT]
lemma fact_psi_bound_odd:
  assumes "odd k"
  shows "ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d=1..k. (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
from fact_expand_psi
[PROOF STATE]
proof (chain)
picking this:
ln (fact ?n) - 2 * ln (fact (?n div 2)) = (\<Sum>d = 1..?n. (- 1) ^ (d + 1) * psi (?n div d))
[PROOF STEP]
have "ln (fact n) - 2 * ln (fact (n div 2)) = (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d))"
[PROOF STATE]
proof (prove)
using this:
ln (fact ?n) - 2 * ln (fact (?n div 2)) = (\<Sum>d = 1..?n. (- 1) ^ (d + 1) * psi (?n div d))

goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) = (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (fact n) - 2 * ln (fact (n div 2)) = (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact n) - 2 * ln (fact (n div 2)) = (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>d=1..k. (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
proof (cases "k \<le> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
 2. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k \<le> n

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
 2. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
have "(\<Sum>d=1..n. (-1)^(d+1) * psi (n div d)) \<le> (
             \<Sum>d=1..2*(n div 2)+1. (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
by (cases "even n") (simp_all add: psi_pos)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d))

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
 2. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d))

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
 2. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
from True assms psi_expansion_cutoff(2)[of "k div 2" "n div 2" n]
[PROOF STATE]
proof (chain)
picking this:
k \<le> n
odd k
k div 2 \<le> n div 2 \<Longrightarrow> (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2) + 1. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>d=1..k. (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
using this:
k \<le> n
odd k
k div 2 \<le> n div 2 \<Longrightarrow> (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2) + 1. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. (\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..2 * (n div 2) + 1. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (2 subgoals):
 1. k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
 2. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k \<le> n

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
have "(\<Sum>d=1..n. (-1)^(d+1) * psi (n div d)) \<le> (\<Sum>d=1..2*((n+1) div 2). (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
by (cases "even n") (simp_all add: psi_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
from False assms psi_expansion_cutoff(1)[of "(n+1) div 2" "k div 2" n]
[PROOF STATE]
proof (chain)
picking this:
\<not> k \<le> n
odd k
(n + 1) div 2 \<le> k div 2 \<Longrightarrow> (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
have "(\<Sum>d=1..2*((n+1) div 2). (-1)^(d+1) * psi (n div d)) \<le> (\<Sum>d=1..2*(k div 2). (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> n
odd k
(n + 1) div 2 \<le> k div 2 \<Longrightarrow> (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. (\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..2 * ((n + 1) div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
odd k
[PROOF STEP]
have "\<dots> \<le> (\<Sum>d=1..k. (-1)^(d+1) * psi (n div d))"
[PROOF STATE]
proof (prove)
using this:
odd k

goal (1 subgoal):
 1. (\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
by (auto elim: oddE simp: psi_pos)
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..2 * (k div 2). (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. \<not> k \<le> n \<Longrightarrow> (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. (\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>d = 1..n. (- 1) ^ (d + 1) * psi (n div d)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal (1 subgoal):
 1. ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (fact n) - 2 * ln (fact (n div 2)) \<le> (\<Sum>d = 1..k. (- 1) ^ (d + 1) * psi (n div d))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_mult:
  "[b = c] (mod a) \<Longrightarrow> [d = e] (mod a) \<Longrightarrow> [b * d = c * e] (mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>[b = c] (mod a); [d = e] (mod a)\<rbrakk> \<Longrightarrow> [b * d = c * e] (mod a)
[PROOF STEP]
by (auto simp add: cong_def intro: mod_mult_cong)


[STATEMENT]
lemma poly_has_sgnx_left_right:
  fixes c a::real and p::"real poly"
  assumes "p\<noteq>0"
  shows "(poly p has_sgnx c) (at_left a) \<longleftrightarrow> (if even (order a p)
            then (poly p has_sgnx c) (at_right a)
            else (poly p has_sgnx -c) (at_right a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p has_sgnx c) (at_left a) = (if even (order a p) then (poly p has_sgnx c) (at_right a) else (poly p has_sgnx - c) (at_right a))
[PROOF STEP]
using poly_sgnx_left_right
[PROOF STATE]
proof (prove)
using this:
?p \<noteq> 0 \<Longrightarrow> sgnx (poly ?p) (at_left ?a) = (if even (order ?a ?p) then sgnx (poly ?p) (at_right ?a) else - sgnx (poly ?p) (at_right ?a))

goal (1 subgoal):
 1. (poly p has_sgnx c) (at_left a) = (if even (order a p) then (poly p has_sgnx c) (at_right a) else (poly p has_sgnx - c) (at_right a))
[PROOF STEP]
by (metis (no_types, opaque_lifting) add.inverse_inverse assms has_sgnx_unique
     sgnx_able_poly sgnx_able_sgnx trivial_limit_at_left_real trivial_limit_at_right_real)


[STATEMENT]
lemma card_size_filter_eq: "finite A \<Longrightarrow>  card {a \<in> A . P a} = size {#a \<in># mset_set A . P a#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> card {a \<in> A. P a} = size (filter_mset P (mset_set A))
[PROOF STEP]
by simp