[STATEMENT]
lemma finite_imp_compact_convex_hull:
  fixes S :: "'a::real_normed_vector set"
  assumes "finite S"
  shows "compact (convex hull S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (convex hull S)
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> compact (convex hull S)
 2. S \<noteq> {} \<Longrightarrow> compact (convex hull S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> compact (convex hull S)
 2. S \<noteq> {} \<Longrightarrow> compact (convex hull S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. compact (convex hull S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compact (convex hull S)

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> compact (convex hull S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> compact (convex hull S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> compact (convex hull S)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite S
S \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite S
S \<noteq> {}

goal (1 subgoal):
 1. compact (convex hull S)
[PROOF STEP]
proof (induct rule: finite_ne_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. compact (convex hull {x})
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
case (singleton x)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x. compact (convex hull {x})
 2. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (convex hull {x})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compact (convex hull {x})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {}
x \<notin> A
compact (convex hull A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
let ?f = "\<lambda>(u, y::'a). u *\<^sub>R x + (1 - u) *\<^sub>R y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
let ?T = "{0..1::real} \<times> (convex hull A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
have "continuous_on ?T ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> (convex hull A)) (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y)
[PROOF STEP]
unfolding split_def continuous_on
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>{0..1} \<times> (convex hull A). ((\<lambda>p. fst p *\<^sub>R x + (1 - fst p) *\<^sub>R snd p) \<longlongrightarrow> fst xa *\<^sub>R x + (1 - fst xa) *\<^sub>R snd xa) (at xa within {0..1} \<times> (convex hull A))
[PROOF STEP]
by (intro ballI tendsto_intros)
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> (convex hull A)) (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> (convex hull A)) (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
have "compact ?T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact ({0..1} \<times> (convex hull A))
[PROOF STEP]
by (intro compact_Times compact_Icc insert)
[PROOF STATE]
proof (state)
this:
compact ({0..1} \<times> (convex hull A))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
continuous_on ({0..1} \<times> (convex hull A)) (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y)
compact ({0..1} \<times> (convex hull A))
[PROOF STEP]
have "compact (?f ` ?T)"
[PROOF STATE]
proof (prove)
using this:
continuous_on ({0..1} \<times> (convex hull A)) (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y)
compact ({0..1} \<times> (convex hull A))

goal (1 subgoal):
 1. compact ((\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)))
[PROOF STEP]
by (rule compact_continuous_image)
[PROOF STATE]
proof (state)
this:
compact ((\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
compact ((\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
have "?f ` ?T = convex hull (insert x A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)) = convex hull insert x A
[PROOF STEP]
unfolding convex_hull_insert [OF \<open>A \<noteq> {}\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)) = {xa. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. u + v = 1 \<and> b \<in> convex hull A \<and> xa = u *\<^sub>R x + v *\<^sub>R b}
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa a b. \<lbrakk>a \<in> {0..1}; b \<in> convex hull A\<rbrakk> \<Longrightarrow> \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>ba. u + v = 1 \<and> ba \<in> convex hull A \<and> a *\<^sub>R x + (1 - a) *\<^sub>R b = u *\<^sub>R x + v *\<^sub>R ba
 2. \<And>xa u v b. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; b \<in> convex hull A\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R b \<in> (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A))
[PROOF STEP]
apply (rule_tac x=a in exI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>0 \<le> a \<and> a \<le> 1; b \<in> convex hull A\<rbrakk> \<Longrightarrow> \<exists>v\<ge>0. a + v = 1 \<and> (\<exists>ba. ba \<in> convex hull A \<and> (1 - a) *\<^sub>R b = v *\<^sub>R ba)
 2. \<And>xa u v b. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; b \<in> convex hull A\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R b \<in> (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A))
[PROOF STEP]
apply (rule_tac x="1 - a" in exI, simp, fast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa u v b. \<lbrakk>0 \<le> u; 0 \<le> v; u + v = 1; b \<in> convex hull A\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R b \<in> (\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A))
[PROOF STEP]
apply (rule_tac x="(u, b)" in image_eqI, simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>(u, y). u *\<^sub>R x + (1 - u) *\<^sub>R y) ` ({0..1} \<times> (convex hull A)) = convex hull insert x A

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; F \<noteq> {}; x \<notin> F; compact (convex hull F)\<rbrakk> \<Longrightarrow> compact (convex hull insert x F)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
compact (convex hull insert x A)
[PROOF STEP]
show "compact (convex hull (insert x A))"
[PROOF STATE]
proof (prove)
using this:
compact (convex hull insert x A)

goal (1 subgoal):
 1. compact (convex hull insert x A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
compact (convex hull insert x A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
compact (convex hull S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lin_comb_imp_lin_dep_fin:
  fixes A :: "'a vec set"
  assumes "finite A"
  assumes "A \<subseteq> carrier_vec n"
  assumes "lincomb c A = 0\<^sub>v n"
  assumes "\<exists> a. a \<in> A \<and> c a \<noteq> 0"
  shows "lin_dep A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_dep A
[PROOF STEP]
unfolding lin_dep_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Aa a v. finite Aa \<and> Aa \<subseteq> A \<and> True \<and> lincomb a Aa = 0\<^sub>v n \<and> v \<in> Aa \<and> a v \<noteq> (0::'a)
[PROOF STEP]
using assms lincomb_as_lincomb_list_distinct sumlist_nth
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier_vec n
lincomb c A = 0\<^sub>v n
\<exists>a. a \<in> A \<and> c a \<noteq> (0::'a)
\<lbrakk>set ?ws \<subseteq> carrier_vec n; distinct ?ws\<rbrakk> \<Longrightarrow> lincomb ?f (set ?ws) = lincomb_list (\<lambda>i. ?f (?ws ! i)) ?ws
\<lbrakk>\<forall>x\<in>set ?xs. dim_vec x = n; ?i < n\<rbrakk> \<Longrightarrow> M.sumlist ?xs $ ?i = (\<Sum>j = 0..<length ?xs. ?xs ! j $ ?i)

goal (1 subgoal):
 1. \<exists>Aa a v. finite Aa \<and> Aa \<subseteq> A \<and> True \<and> lincomb a Aa = 0\<^sub>v n \<and> v \<in> Aa \<and> a v \<noteq> (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma mignotte_coeff_helper:
  "abs (coeff h i) \<le>
   (degree h - 1 choose i) * mahler_measure h +
   (min i 1 * (degree h - 1 choose (i - 1)) * abs (lead_coeff h))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff h i\<bar> \<le> real (degree h - 1 choose i) * mahler_measure h + real_of_int (int (min i 1 * (degree h - 1 choose (i - 1))) * \<bar>lead_coeff h\<bar>)
[PROOF STEP]
unfolding mahler_measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff h i\<bar> \<le> real (degree h - 1 choose i) * mahler_measure_poly (of_int_poly h) + real_of_int (int (min i 1 * (degree h - 1 choose (i - 1))) * \<bar>lead_coeff h\<bar>)
[PROOF STEP]
using mignotte_helper_coeff[of "of_int_poly h" i]
[PROOF STATE]
proof (prove)
using this:
cmod (poly.coeff (of_int_poly h) i) \<le> real (degree (of_int_poly h) - 1 choose i) * mahler_measure_poly (of_int_poly h) + real (min i 1 * (degree (of_int_poly h) - 1 choose (i - 1))) * cmod (lead_coeff (of_int_poly h))

goal (1 subgoal):
 1. real_of_int \<bar>poly.coeff h i\<bar> \<le> real (degree h - 1 choose i) * mahler_measure_poly (of_int_poly h) + real_of_int (int (min i 1 * (degree h - 1 choose (i - 1))) * \<bar>lead_coeff h\<bar>)
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_ceiling_eq:
  fixes f::"'a \<Rightarrow> 'b::{order_topology,floor_ceiling}"
  assumes f: "(f \<longlongrightarrow> l) F"
    and l: "l \<notin> \<int>"
  shows "\<forall>\<^sub>F x in F. ceiling (f x) = ceiling l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<lceil>f x\<rceil> = \<lceil>l\<rceil>
[PROOF STEP]
using eventually_floor_less[OF assms] eventually_less_ceiling[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. of_int \<lfloor>l\<rfloor> < f x
\<forall>\<^sub>F x in F. f x < of_int \<lceil>l\<rceil>

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<lceil>f x\<rceil> = \<lceil>l\<rceil>
[PROOF STEP]
by eventually_elim (meson floor_less_iff less_ceiling_iff not_less_iff_gr_or_eq)


[STATEMENT]
lemma euclid_diff:
   "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y \<and> x > 0 \<and> y > 0)
    (WHILE (\<lambda>s. s ''x''\<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
     DO
        (IF (\<lambda>s. s ''x'' >  s ''y'')
         THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y''))
         ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x''))
         FI)
    OD)
    POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y \<and> zero_class.zero < x \<and> zero_class.zero < y\<rceil> \<subseteq> wp (WHILE (\<lambda>s. s ''x'' \<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) DO (IF (\<lambda>s. s ''y'' < s ''x'') THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y'')) ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x'')) FI) OD) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
apply (rule ppath_aka.fbox_whilei, simp_all)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y \<and> zero_class.zero < x \<and> zero_class.zero < y\<rceil> \<subseteq> \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>
 2. \<lceil>(\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) \<sqinter> - (\<lambda>s. s ''x'' \<noteq> s ''y'')\<rceil> \<subseteq> \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
 3. \<lceil>(\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) \<sqinter> (\<lambda>s. s ''x'' \<noteq> s ''y'')\<rceil> \<subseteq> \<lceil>(- (\<lambda>s. s ''y'' < s ''x'') \<squnion> (\<lambda>s. gcd (s ''x'' - s ''y'') (s ''y'') = gcd x y)) \<sqinter> ((\<lambda>s. s ''y'' < s ''x'') \<squnion> (\<lambda>s. gcd (s ''x'') (s ''y'' - s ''x'') = gcd x y))\<rceil>
[PROOF STEP]
apply (simp_all add: p2pp_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. {Node s |s. s ''x'' = x \<and> s ''y'' = y \<and> zero_class.zero < x \<and> zero_class.zero < y} \<subseteq> {Node s |s. gcd (s ''x'') (s ''y'') = gcd x y}
 2. {Node s |s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' = s ''y''} \<subseteq> {Node s |s. s ''x'' = gcd x y}
 3. {Node s |s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' \<noteq> s ''y''} \<subseteq> {Node s |s. (s ''y'' < s ''x'' \<longrightarrow> gcd (s ''x'' - s ''y'') (s ''y'') = gcd x y) \<and> (s ''y'' < s ''x'' \<or> gcd (s ''x'') (s ''y'' - s ''x'') = gcd x y)}
[PROOF STEP]
apply auto[2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Node s |s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' \<noteq> s ''y''} \<subseteq> {Node s |s. (s ''y'' < s ''x'' \<longrightarrow> gcd (s ''x'' - s ''y'') (s ''y'') = gcd x y) \<and> (s ''y'' < s ''x'' \<or> gcd (s ''x'') (s ''y'' - s ''x'') = gcd x y)}
[PROOF STEP]
by (safe, metis gcd.commute gcd_diff1_nat le_cases nat_less_le)


[STATEMENT]
lemma rank_1_proj_coord:
  assumes "i < dim_vec v"
  and "j < dim_vec v"
shows "(rank_1_proj v) $$ (i, j) = Matrix.vec_index v i * (cnj (Matrix.vec_index v j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj v $$ (i, j) = v $ i * cnj (v $ j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_vec v
j < dim_vec v

goal (1 subgoal):
 1. rank_1_proj v $$ (i, j) = v $ i * cnj (v $ j)
[PROOF STEP]
unfolding rank_1_proj_def outer_prod_def
[PROOF STATE]
proof (prove)
using this:
i < dim_vec v
j < dim_vec v

goal (1 subgoal):
 1. (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec v) (\<lambda>(i, y). conjugate v $ y)) $$ (i, j) = v $ i * cnj (v $ j)
[PROOF STEP]
by auto


[STATEMENT]
lemma unat_minus_one_word:
  "unat (-1 :: 'a :: len word) = 2 ^ LENGTH('a) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (- 1) = 2 ^ LENGTH('a) - 1
[PROOF STEP]
by (simp add: mask_eq_exp_minus_1 unsigned_minus_1_eq_mask)


[STATEMENT]
lemma transpose_rank:
  fixes A::"'a::{conjugatable_ordered_field} mat"
  shows "vec_space.rank (dim_row A) A = vec_space.rank (dim_col A) (A\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_space.rank (dim_row A) A = vec_space.rank (dim_col A) A\<^sup>T
[PROOF STEP]
by (metis carrier_mat_triv conjugatable_vec_space.rank_conjugate conjugate_transpose_rank index_transpose_mat(2))


[STATEMENT]
lemma sum_add_split_nat_ivl:
  assumes le: "m <= (k::nat)" "k <= n"
    and g: "!!i. [| m <= i; i < k |] ==> g i = f i"
    and h: "!!i. [| k <= i; i < n |] ==> h i = f i"
  shows "sum g {m..<k} + sum h {k..<n} = sum f {m..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum g {m..<k} + sum h {k..<n} = sum f {m..<n}
[PROOF STEP]
using le g h
[PROOF STATE]
proof (prove)
using this:
m \<le> k
k \<le> n
\<lbrakk>m \<le> ?i; ?i < k\<rbrakk> \<Longrightarrow> g ?i = f ?i
\<lbrakk>k \<le> ?i; ?i < n\<rbrakk> \<Longrightarrow> h ?i = f ?i

goal (1 subgoal):
 1. sum g {m..<k} + sum h {k..<n} = sum f {m..<n}
[PROOF STEP]
by (simp add: sum.atLeastLessThan_concat cong: sum.cong_simp)


[STATEMENT]
lemma complex_unit_circle: "z \<noteq> 0 \<Longrightarrow> (Re z / cmod z)\<^sup>2 + (Im z / cmod z)\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> (Re z / cmod z)\<^sup>2 + (Im z / cmod z)\<^sup>2 = 1
[PROOF STEP]
by (simp add: norm_complex_def complex_eq_iff power2_eq_square add_divide_distrib [symmetric])


[STATEMENT]
lemma multiplicity_Lcm_atLeast1AtMost_Suc:
  fixes p n :: nat
  assumes p: "prime p" and n: "n > 0"
  shows "multiplicity p (Lcm {1..Suc n}) =
           (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
define k where "k = Max (multiplicity p ` {1..n})"
[PROOF STATE]
proof (state)
this:
k = Max (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
define l where "l = multiplicity p (Suc n)"
[PROOF STATE]
proof (state)
this:
l = multiplicity p (Suc n)

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have eq: "{1..Suc n} = insert (Suc n) {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..Suc n} = insert (Suc n) {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..Suc n} = insert (Suc n) {1..n}

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
from \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
by (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})
[PROOF STEP]
by (subst multiplicity_Lcm) auto
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "multiplicity p ` {1..Suc n} =
               insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})
[PROOF STEP]
by (simp only: eq image_insert)
[PROOF STATE]
proof (state)
this:
multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "Max \<dots> = max l k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k
[PROOF STEP]
unfolding l_def k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max (multiplicity p (Suc n)) (Max (multiplicity p ` {1..n}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n

goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max (multiplicity p (Suc n)) (Max (multiplicity p ` {1..n}))
[PROOF STEP]
by (subst Max.insert) auto
[PROOF STATE]
proof (state)
this:
Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "\<dots> = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
proof (cases "\<exists>k. Suc n = p ^ k")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>k. Suc n = p ^ k

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "p ^ l dvd Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ l dvd Suc n
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p (Suc n) dvd Suc n
[PROOF STEP]
by (intro multiplicity_dvd)
[PROOF STATE]
proof (state)
this:
p ^ l dvd Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
hence "p ^ l \<le> Suc n"
[PROOF STATE]
proof (prove)
using this:
p ^ l dvd Suc n

goal (1 subgoal):
 1. p ^ l \<le> Suc n
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p (Suc n) dvd Suc n

goal (1 subgoal):
 1. p ^ multiplicity p (Suc n) \<le> Suc n
[PROOF STEP]
by (intro dvd_imp_le multiplicity_dvd) auto
[PROOF STATE]
proof (state)
this:
p ^ l \<le> Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ l \<le> Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "Suc n \<noteq> p ^ l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n \<noteq> p ^ l
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<nexists>k. Suc n = p ^ k

goal (1 subgoal):
 1. Suc n \<noteq> p ^ l
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Suc n \<noteq> p ^ l

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ l \<le> Suc n
Suc n \<noteq> p ^ l
[PROOF STEP]
have "p ^ l < Suc n"
[PROOF STATE]
proof (prove)
using this:
p ^ l \<le> Suc n
Suc n \<noteq> p ^ l

goal (1 subgoal):
 1. p ^ l < Suc n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
p ^ l < Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ l < Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "p ^ l > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ l
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 0 < p ^ l
[PROOF STEP]
by (intro zero_less_power) auto
[PROOF STATE]
proof (state)
this:
0 < p ^ l

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ l < Suc n
0 < p ^ l
[PROOF STEP]
have "l = multiplicity p (p ^ l)" and "p ^ l \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
p ^ l < Suc n
0 < p ^ l

goal (1 subgoal):
 1. l = multiplicity p (p ^ l) &&& p ^ l \<in> {1..n}
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ l < Suc n
0 < p ^ l
prime p

goal (1 subgoal):
 1. l = multiplicity p (p ^ l) &&& p ^ l \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
hence "l \<le> k"
[PROOF STATE]
proof (prove)
using this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (1 subgoal):
 1. l \<le> k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (1 subgoal):
 1. l \<le> Max (multiplicity p ` {1..n})
[PROOF STEP]
by (intro Max.coboundedI) auto
[PROOF STATE]
proof (state)
this:
l \<le> k

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<nexists>k. Suc n = p ^ k
l \<le> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nexists>k. Suc n = p ^ k
l \<le> k

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
by (simp add: l_def k_def)
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. Suc n = p ^ k
[PROOF STEP]
obtain x where x: "Suc n = p ^ x"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. (\<And>x. Suc n = p ^ x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Suc n = p ^ x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
from x and \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
Suc n = p ^ x
0 < n
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x
0 < n

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (intro Nat.gr0I) auto
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
Suc n = p ^ x
[PROOF STEP]
have [simp]: "l = x"
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x

goal (1 subgoal):
 1. l = x
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x
prime p

goal (1 subgoal):
 1. l = x
[PROOF STEP]
by (simp add: l_def)
[PROOF STATE]
proof (state)
this:
l = x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "x = k + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = k + 1
[PROOF STEP]
proof (intro antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
have "p ^ (x - 1) < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ (x - 1) < Suc n
[PROOF STEP]
using \<open>x > 0\<close> \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < p

goal (1 subgoal):
 1. p ^ (x - 1) < Suc n
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < p

goal (1 subgoal):
 1. p ^ (x - 1) < p ^ x
[PROOF STEP]
by (intro power_strict_increasing) auto
[PROOF STATE]
proof (state)
this:
p ^ (x - 1) < Suc n

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ (x - 1) < Suc n

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
have "p ^ (x - 1) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ (x - 1)
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 0 < p ^ (x - 1)
[PROOF STEP]
by (intro zero_less_power) auto
[PROOF STATE]
proof (state)
this:
0 < p ^ (x - 1)

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)
[PROOF STEP]
have "multiplicity p (p ^ (x - 1)) = x - 1" and "p ^ (x - 1) \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)

goal (1 subgoal):
 1. multiplicity p (p ^ (x - 1)) = x - 1 &&& p ^ (x - 1) \<in> {1..n}
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)
prime p

goal (1 subgoal):
 1. multiplicity p (p ^ (x - 1)) = x - 1 &&& p ^ (x - 1) \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
hence "x - 1 \<le> k"
[PROOF STATE]
proof (prove)
using this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (1 subgoal):
 1. x - 1 \<le> k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (1 subgoal):
 1. x - 1 \<le> Max (multiplicity p ` {1..n})
[PROOF STEP]
by (intro Max.coboundedI) force+
[PROOF STATE]
proof (state)
this:
x - 1 \<le> k

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
thus "x \<le> k + 1"
[PROOF STATE]
proof (prove)
using this:
x - 1 \<le> k

goal (1 subgoal):
 1. x \<le> k + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x \<le> k + 1

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
have "multiplicity p y < x" if "y \<in> {1..n}" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "p ^ multiplicity p y \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p y \<le> y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<in> {1..n}

goal (1 subgoal):
 1. p ^ multiplicity p y \<le> y
[PROOF STEP]
by (intro dvd_imp_le multiplicity_dvd) auto
[PROOF STATE]
proof (state)
this:
p ^ multiplicity p y \<le> y

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ^ multiplicity p y \<le> y

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "\<dots> < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < Suc n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<in> {1..n}

goal (1 subgoal):
 1. y < Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y < Suc n

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y < Suc n

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "\<dots> = p ^ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n = p ^ x
[PROOF STEP]
by (fact x)
[PROOF STATE]
proof (state)
this:
Suc n = p ^ x

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ^ multiplicity p y < p ^ x
[PROOF STEP]
show "multiplicity p y < x"
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p y < p ^ x

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p y < p ^ x
1 < p

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
by (subst (asm) power_strict_increasing_iff)
[PROOF STATE]
proof (state)
this:
multiplicity p y < x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
hence "k < x"
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x

goal (1 subgoal):
 1. k < x
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x
0 < n

goal (1 subgoal):
 1. k < x
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x
0 < n

goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) < x
[PROOF STEP]
by (subst Max_less_iff) auto
[PROOF STATE]
proof (state)
this:
k < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
thus "k + 1 \<le> x"
[PROOF STATE]
proof (prove)
using this:
k < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k + 1 \<le> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = k + 1

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x = k + 1

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x = k + 1
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "k = multiplicity p (Lcm {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = multiplicity p (Lcm {1..n})
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) = multiplicity p (Lcm {1..n})
[PROOF STEP]
using \<open>n > 0\<close> and \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p

goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) = multiplicity p (Lcm {1..n})
[PROOF STEP]
by (subst multiplicity_Lcm) auto
[PROOF STATE]
proof (state)
this:
k = multiplicity p (Lcm {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem catalan_integral_form:
  "((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2*pi))
       has_integral real (catalan n)) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
have "((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2*pi)) has_integral
           I n * inverse (2 * pi)) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral integral {0..4} (\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x)) * inverse (2 * pi)) {0..4}
[PROOF STEP]
by (intro has_integral_mult_left integrable_integral integrable_I)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
by (simp add: catalan_eq_I field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_def: "\<parallel>A\<parallel>\<^sub>o\<^sub>p = Sup {\<parallel>A *v x\<parallel> | x. \<parallel>x\<parallel> = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p = Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
[PROOF STEP]
apply(rule antisym[OF onorm_le cSup_least[OF op_norm_set_proptys(3)]])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<parallel>A *v x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} * \<parallel>x\<parallel>
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(case_tac "x = 0", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} * \<parallel>x\<parallel>
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(subst mult_norm_matrix_sgn_eq[symmetric], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v sgn x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(rule cSup_upper[OF _ op_norm_set_proptys(2)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v sgn x\<parallel> \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(force simp: norm_sgn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
unfolding onorm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> (SUP x. \<parallel>A *v x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
apply(rule cSup_upper[OF _ onorm_set_proptys(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<in> range (\<lambda>x. \<parallel>A *v x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
by (simp add: image_def, clarsimp) (metis div_by_1)


[STATEMENT]
lemma norm_sum_Pythagorean:
  assumes "finite I" "pairwise (\<lambda>i j. orthogonal (f i) (f j)) I"
    shows "(norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I

goal (1 subgoal):
 1. (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
[PROOF STEP]
proof (induction I rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pairwise (\<lambda>i j. orthogonal (f i) (f j)) {} \<Longrightarrow> (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}

goal (2 subgoals):
 1. pairwise (\<lambda>i j. orthogonal (f i) (f j)) {} \<Longrightarrow> (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}

goal (1 subgoal):
 1. (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
case (insert x I)
[PROOF STATE]
proof (state)
this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
[PROOF STEP]
have "orthogonal (f x) (sum f I)"
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)

goal (1 subgoal):
 1. orthogonal (f x) (sum f I)
[PROOF STEP]
by (metis pairwise_insert orthogonal_rvsum)
[PROOF STATE]
proof (state)
this:
orthogonal (f x) (sum f I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
orthogonal (f x) (sum f I)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
orthogonal (f x) (sum f I)

goal (1 subgoal):
 1. (norm (sum f (insert x I)))\<^sup>2 = (\<Sum>i\<in>insert x I. (norm (f i))\<^sup>2)
[PROOF STEP]
by (simp add: pairwise_insert norm_add_Pythagorean)
[PROOF STATE]
proof (state)
this:
(norm (sum f (insert x I)))\<^sup>2 = (\<Sum>i\<in>insert x I. (norm (f i))\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_permutations_of_multiset_remove_aux:
  assumes "x \<in># A"
  shows   "card (permutations_of_multiset A) * count A x =
             size A * card (permutations_of_multiset (A - {#x#}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in># A
[PROOF STEP]
have A: "A - {#x#} + {#x#} = A"
[PROOF STATE]
proof (prove)
using this:
x \<in># A

goal (1 subgoal):
 1. A - {#x#} + {#x#} = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A - {#x#} + {#x#} = A

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in># A
[PROOF STEP]
have B: "size A = size (A - {#x#}) + 1"
[PROOF STATE]
proof (prove)
using this:
x \<in># A

goal (1 subgoal):
 1. size A = size (A - {#x#}) + 1
[PROOF STEP]
by (subst A [symmetric], subst size_union) simp
[PROOF STATE]
proof (state)
this:
size A = size (A - {#x#}) + 1

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
using card_permutations_of_multiset_insert_aux[of "A - {#x#}" x, unfolded A] assms
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset A) * (count (A - {#x#}) x + 1) = (size (A - {#x#}) + 1) * card (permutations_of_multiset (A - {#x#}))
x \<in># A

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
by (simp add: B)
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Im_Arccos_bound: "\<bar>Im (Arccos w)\<bar> \<le> cmod w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
have "(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2
[PROOF STEP]
using norm_cos_squared [of "Arccos w"] real_le_abs_sinh [of "Im (Arccos w)"]
[PROOF STATE]
proof (prove)
using this:
(cmod (cos (Arccos w)))\<^sup>2 = (cos (Re (Arccos w)))\<^sup>2 + (exp (Im (Arccos w)) - inverse (exp (Im (Arccos w))))\<^sup>2 / 4
\<bar>Im (Arccos w)\<bar> \<le> \<bar>(exp (Im (Arccos w)) - inverse (exp (Im (Arccos w)))) / 2\<bar>

goal (1 subgoal):
 1. (Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2
[PROOF STEP]
by (simp only: abs_le_square_iff) (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
have "\<dots> \<le> (cmod w)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2 \<le> (cmod w)\<^sup>2
[PROOF STEP]
by (auto simp: cmod_power2)
[PROOF STATE]
proof (state)
this:
(cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2 \<le> (cmod w)\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
using abs_le_square_iff
[PROOF STATE]
proof (prove)
using this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2
(\<bar>?x\<bar> \<le> \<bar>?y\<bar>) = (?x\<^sup>2 \<le> ?y\<^sup>2)

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<bar>Im (Arccos w)\<bar> \<le> cmod w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_kronecker[simp]:
  "dim_row (kronecker_product A B) = dim_row A * dim_row B"
  "dim_col (kronecker_product A B) = dim_col A * dim_col B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (kronecker_product A B) = dim_row A * dim_row B &&& dim_col (kronecker_product A B) = dim_col A * dim_col B
[PROOF STEP]
unfolding kronecker_product_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B))) = dim_row A * dim_row B &&& dim_col (mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B))) = dim_col A * dim_col B
[PROOF STEP]
by auto


[STATEMENT]
lemma orthogonal_iff_vangle: "orthogonal u v \<longleftrightarrow> vangle u v = pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal u v = (vangle u v = pi / 2)
[PROOF STEP]
using arccos_eq_iff[of "u \<bullet> v / (norm u * norm v)" 0] Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
\<bar>u \<bullet> v / (norm u * norm v)\<bar> \<le> 1 \<and> \<bar>0\<bar> \<le> 1 \<Longrightarrow> (arccos (u \<bullet> v / (norm u * norm v)) = arccos 0) = (u \<bullet> v / (norm u * norm v) = 0)
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. orthogonal u v = (vangle u v = pi / 2)
[PROOF STEP]
by (auto simp: vangle_def orthogonal_def)


[STATEMENT]
lemma powrat_power_eq:
   "0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
 2. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < a

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
 2. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
using powrat_add
[PROOF STATE]
proof (prove)
using this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a
0 < ?x \<Longrightarrow> ?x pow\<^sub>\<rat> (?r + ?s) = ?x pow\<^sub>\<rat> ?r * ?x pow\<^sub>\<rat> ?s

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_permutations_of_multiset_insert_aux:
  "card (permutations_of_multiset (A + {#x#})) * (count A x + 1) =
      (size A + 1) * card (permutations_of_multiset A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note card_permutations_of_multiset_aux[of "A + {#x#}"]
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (\<Prod>xa\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) xa)) = fact (size (A + {#x#}))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (\<Prod>xa\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) xa)) = fact (size (A + {#x#}))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
have "fact (size (A + {#x#})) = (size A + 1) * fact (size A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (size (A + {#x#})) = (size A + 1) * fact (size A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact (size (A + {#x#})) = (size A + 1) * fact (size A)

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (size (A + {#x#})) = (size A + 1) * fact (size A)

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note multiset_prod_fact_insert[of A x]
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note card_permutations_of_multiset_aux[of A, symmetric]
[PROOF STATE]
proof (state)
this:
fact (size A) = card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (permutations_of_multiset (A + {#x#})) * ((count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))) = (size A + 1) * (card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x)))
[PROOF STEP]
have "card (permutations_of_multiset (A + {#x#})) * (count A x + 1) *
                    (\<Prod>y\<in>set_mset A. fact (count A y)) =
                (size A + 1) * card (permutations_of_multiset A) *
                    (\<Prod>x\<in>set_mset A. fact (count A x))"
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset (A + {#x#})) * ((count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))) = (size A + 1) * (card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x)))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))
[PROOF STEP]
by (simp only: mult_ac)
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
by (subst (asm) mult_right_cancel) simp_all
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_exponent_ennrealI:
  assumes "1/p + 1/q = (1::ennreal)"
  shows "p \<ge> 1" "q \<ge> 1" "p = conjugate_exponent q" "q = conjugate_exponent p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<le> p &&& 1 \<le> q) &&& p = conjugate_exponent q &&& q = conjugate_exponent p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. 1 \<le> p
 2. 1 \<le> q
 3. p = conjugate_exponent q
 4. q = conjugate_exponent p
[PROOF STEP]
have "1/p \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 / p + 1 / q = 1

goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
using le_iff_add
[PROOF STATE]
proof (prove)
using this:
1 / p + 1 / q = 1
(?a \<le> ?b) = (\<exists>c. ?b = ?a + c)

goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
1 / p \<le> 1

goal (4 subgoals):
 1. 1 \<le> p
 2. 1 \<le> q
 3. p = conjugate_exponent q
 4. q = conjugate_exponent p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 / p \<le> 1
[PROOF STEP]
show "p \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 / p \<le> 1

goal (1 subgoal):
 1. 1 \<le> p
[PROOF STEP]
by (metis assms divide_ennreal_def ennreal_add_eq_top ennreal_divide_self ennreal_divide_zero ennreal_le_epsilon ennreal_one_neq_top mult.left_neutral mult_left_le zero_le)
[PROOF STATE]
proof (state)
this:
1 \<le> p

goal (3 subgoals):
 1. 1 \<le> q
 2. p = conjugate_exponent q
 3. q = conjugate_exponent p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> p
[PROOF STEP]
show "q = conjugate_exponent p"
[PROOF STATE]
proof (prove)
using this:
1 \<le> p

goal (1 subgoal):
 1. q = conjugate_exponent p
[PROOF STEP]
using conjugate_exponent_ennreal_iff assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
1 \<le> ?p \<Longrightarrow> (?q = conjugate_exponent ?p) = (1 / ?p + 1 / ?q = 1)
1 / p + 1 / q = 1

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

goal (2 subgoals):
 1. 1 \<le> q
 2. p = conjugate_exponent q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q = conjugate_exponent p
[PROOF STEP]
show "q \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
q = conjugate_exponent p

goal (1 subgoal):
 1. 1 \<le> q
[PROOF STEP]
using conjugate_exponent_ennreal[OF \<open>p \<ge> 1\<close>]
[PROOF STATE]
proof (prove)
using this:
q = conjugate_exponent p
1 / p + 1 / conjugate_exponent p = 1
1 \<le> conjugate_exponent p
conjugate_exponent (conjugate_exponent p) = p

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

goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
show "p = conjugate_exponent q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
using conjugate_exponent_ennreal_iff[OF \<open>q\<ge>1\<close>, of p] assms
[PROOF STATE]
proof (prove)
using this:
(p = conjugate_exponent q) = (1 / q + 1 / p = 1)
1 / p + 1 / q = 1

goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
p = conjugate_exponent q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_list_dvd_prod_list_subset:
fixes A::"'b::comm_monoid_mult list"
assumes dA: "distinct A"
  and dB: "distinct B" (*Maybe this condition could be avoided*)
  and s: "set A \<subseteq> set B"
shows "prod_list A dvd prod_list B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "prod_list A = prod_list (map id A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A = prod_list (map id A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod_list A = prod_list (map id A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list A = prod_list (map id A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod id (set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id A) = prod id (set A)
[PROOF STEP]
by (rule prod.distinct_set_conv_list[symmetric, OF dA])
[PROOF STATE]
proof (state)
this:
prod_list (map id A) = prod id (set A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list (map id A) = prod id (set A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... dvd prod id (set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set A) dvd prod id (set B)
[PROOF STEP]
by (rule prod_dvd_prod_subset[OF _ s], auto)
[PROOF STATE]
proof (state)
this:
prod id (set A) dvd prod id (set B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id (set A) dvd prod id (set B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod_list (map id B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set B) = prod_list (map id B)
[PROOF STEP]
by (rule prod.distinct_set_conv_list[OF dB])
[PROOF STATE]
proof (state)
this:
prod id (set B) = prod_list (map id B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id (set B) = prod_list (map id B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod_list B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id B) = prod_list B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list (map id B) = prod_list B

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod_list A dvd prod_list B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod_list A dvd prod_list B

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod_list A dvd prod_list B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kronecker_distr_left:
  assumes "dim_row B = dim_row C" "dim_col B = dim_col C"
  shows "kronecker_product A (B+C) = kronecker_product A B + kronecker_product A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kronecker_product A (B + C) = kronecker_product A B + kronecker_product A C
[PROOF STEP]
unfolding kronecker_product_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row A * dim_row (B + C)) (dim_col A * dim_col (B + C)) (\<lambda>(i, j). A $$ (i div dim_row (B + C), j div dim_col (B + C)) * (B + C) $$ (i mod dim_row (B + C), j mod dim_col (B + C))) = mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B)) + mat (dim_row A * dim_row C) (dim_col A * dim_col C) (\<lambda>(i, j). A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_row B = dim_row C
dim_col B = dim_col C

goal (1 subgoal):
 1. mat (dim_row A * dim_row (B + C)) (dim_col A * dim_col (B + C)) (\<lambda>(i, j). A $$ (i div dim_row (B + C), j div dim_col (B + C)) * (B + C) $$ (i mod dim_row (B + C), j mod dim_col (B + C))) = mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B)) + mat (dim_row A * dim_row C) (dim_col A * dim_col C) (\<lambda>(i, j). A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C))
[PROOF STEP]
apply (auto simp add: mat_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>dim_row B = dim_row C; dim_col B = dim_col C; i < dim_row A * dim_row C; j < dim_col A * dim_col C\<rbrakk> \<Longrightarrow> A $$ (i div dim_row C, j div dim_col C) * (B + C) $$ (i mod dim_row C, j mod dim_col C) = A $$ (i div dim_row C, j div dim_col C) * B $$ (i mod dim_row C, j mod dim_col C) + A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C)
[PROOF STEP]
by (metis (no_types, lifting) distrib_left index_add_mat(1) mod_less_divisor mult_eq_0_iff neq0_conv not_less_zero)


[STATEMENT]
lemma integral_norm_eq_0_iff:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes f[measurable]: "integrable M f"
  shows "(\<integral>x. norm (f x) \<partial>M) = 0 \<longleftrightarrow> emeasure M {x\<in>space M. f x \<noteq> 0} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
have "(\<integral>\<^sup>+x. norm (f x) \<partial>M) = (\<integral>x. norm (f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
integrable M f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
by (intro nn_integral_eq_integral integrable_norm) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
have "(\<integral>x. norm (f x) \<partial>M) = 0 \<longleftrightarrow> (\<integral>\<^sup>+x. norm (f x) \<partial>M) = 0"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> emeasure M {x\<in>space M. ennreal (norm (f x)) \<noteq> 0} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)
[PROOF STEP]
by (intro nn_integral_0_iff) auto
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_mult_lead_coeff:
  assumes "subring K R" "polynomial K p1" "polynomial K p2" and "p1 \<noteq> []" and "p2 \<noteq> []"
  shows "lead_coeff (poly_mult p1 p2) = (lead_coeff p1) \<otimes> (lead_coeff p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
have "poly_mult p1 p2 \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p1 p2 \<noteq> []
[PROOF STEP]
using poly_mult_integral[OF assms(1-3)] assms(4-5)
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 = [] \<Longrightarrow> p1 = [] \<or> p2 = []
p1 \<noteq> []
p2 \<noteq> []

goal (1 subgoal):
 1. poly_mult p1 p2 \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mult p1 p2 \<noteq> []

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
hence "lead_coeff (poly_mult p1 p2) = (coeff (poly_mult p1 p2)) (degree p1 + degree p2)"
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 \<noteq> []

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
[PROOF STEP]
using poly_mult_degree_eq[OF assms(1-3)] assms(4-5)
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 \<noteq> []
degree (poly_mult p1 p2) = (if p1 = [] \<or> p2 = [] then 0 else degree p1 + degree p2)
p1 \<noteq> []
p2 \<noteq> []

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
[PROOF STEP]
by (metis coeff.simps(2) list.collapse)
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
using poly_mult_lead_coeff_aux[OF assms]
[PROOF STATE]
proof (prove)
using this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
local.coeff (poly_mult p1 p2) (degree p1 + degree p2) = lead_coeff p1 \<otimes> lead_coeff p2

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_inverse_numeral:
  "0 < x \<Longrightarrow> x powr (1 / numeral n) = root (numeral n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr (1 / numeral n) = root (numeral n) x
[PROOF STEP]
by (simp add: root_powr_inverse)


[STATEMENT]
lemma card_prop_mono:
  assumes \<open>m \<le> n\<close>
    shows \<open>card {i::nat. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m \<le> n
[PROOF STEP]
have \<open>{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. {i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
have \<open>finite {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i \<le> n \<and> P i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
finite {i. i \<le> n \<and> P i}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
finite {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
by (simp add: card_mono)
[PROOF STATE]
proof (state)
this:
card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_UNIV_iff_lsc_usc:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  shows "(\<forall>x. continuous (at x) f) \<longleftrightarrow> (lsc f) \<and> (usc f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. isCont f x) = (lsc f \<and> usc f)
[PROOF STEP]
by (metis continuous_iff_lsc_usc lsc_def usc_def)


[STATEMENT]
lemma mod_0_div_mult_cancel: "(n mod (m::nat) = 0) = (n div m * m = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n mod m = 0) = (n div m * m = n)
[PROOF STEP]
apply (insert eq_diff_left_iff[OF mod_le_dividend le0, of n m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n - n mod m = n - 0) = (n mod m = 0) \<Longrightarrow> (n mod m = 0) = (n div m * m = n)
[PROOF STEP]
apply (simp add: mult.commute minus_mod_eq_mult_div [symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_Union_le:
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> sets M) \<Longrightarrow> measure M (\<Union>F) \<le> (\<Sum>S\<in>F. measure M S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) \<le> sum (Sigma_Algebra.measure M) F
[PROOF STEP]
using measure_UNION_le[of F "\<lambda>x. x" M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite F; \<And>i. i \<in> F \<Longrightarrow> i \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union>i\<in>F. i) \<le> sum (Sigma_Algebra.measure M) F

goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) \<le> sum (Sigma_Algebra.measure M) F
[PROOF STEP]
by simp


[STATEMENT]
lemma (in group) int_pow_mult:
  assumes "x \<in> carrier G" shows "x [^] (i + j::int) = x [^] i \<otimes> x [^] j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
have [simp]: "-i - j = -j - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - i - j = - j - i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- i - j = - j - i

goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
by (auto simp: assms int_pow_def2 inv_solve_left inv_solve_right nat_add_distrib [symmetric] nat_pow_mult)
[PROOF STATE]
proof (state)
this:
x [^] (i + j) = x [^] i \<otimes> x [^] j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_scalar_matrix_ac:
  fixes k :: "'a::{field}" and x :: "'a::{field}^'n" and A :: "'a^'m^'n"
  shows "x v* (k *k A) = k *s (x v* A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x v* (k *k A) = k *s (x v* A)
[PROOF STEP]
using scalar_vector_matrix_assoc
[PROOF STATE]
proof (prove)
using this:
?k *s ?x v* ?A = ?k *s (?x v* ?A)

goal (1 subgoal):
 1. x v* (k *k A) = k *s (x v* A)
[PROOF STEP]
unfolding vector_matrix_mult_def matrix_scalar_mult_def vec_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>i. (\<chi>j. \<Sum>i\<in>UNIV. ?A $ i $ j * (?k *s ?x) $ i) $ i = (?k *s (\<chi>j. \<Sum>i\<in>UNIV. ?A $ i $ j * ?x $ i)) $ i

goal (1 subgoal):
 1. \<forall>i. (\<chi>j. \<Sum>i\<in>UNIV. (\<chi>i j. k * A $ i $ j) $ i $ j * x $ i) $ i = (k *s (\<chi>j. \<Sum>i\<in>UNIV. A $ i $ j * x $ i)) $ i
[PROOF STEP]
by (auto simp add: sum_distrib_left vector_space_over_itself.scale_scale)


[STATEMENT]
theorem zeta_even_nat:
  "zeta (2 * of_nat n) =
     of_real ((-1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
hence "(\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))
[PROOF STEP]
by (intro sums_zeta_nat) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
from sums_unique2 [OF this nat_even_power_sums_complex] False
[PROOF STATE]
proof (chain)
picking this:
0 < n \<Longrightarrow> zeta (of_nat (2 * n)) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
n \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> zeta (of_nat (2 * n)) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
n \<noteq> 0

goal (1 subgoal):
 1. zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
qed (insert zeta_neg_of_nat[of 0], simp_all)


[STATEMENT]
lemma lm147:
  assumes "card (Pow A) = 2"
  shows "card A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
using assms lm146 [of A]
[PROOF STATE]
proof (prove)
using this:
card (Pow A) = 2
card (Pow A) \<noteq> 0 \<Longrightarrow> card A = Discrete.log (card (Pow A))

goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma NSCDERIV_inverse_fun:
  "NSDERIV f x :> d \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> NSDERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse ((f x)\<^sup>2))"
  for x :: complex
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>NSDERIV f x :> d; f x \<noteq> 0\<rbrakk> \<Longrightarrow> NSDERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse ((f x)\<^sup>2))
[PROOF STEP]
unfolding numeral_2_eq_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>NSDERIV f x :> d; f x \<noteq> 0\<rbrakk> \<Longrightarrow> NSDERIV (\<lambda>x. inverse (f x)) x :> - (d * inverse (f x ^ Suc (Suc 0)))
[PROOF STEP]
by (rule NSDERIV_inverse_fun)


[STATEMENT]
lemma overdamped_door_arith:
  assumes "b\<^sup>2 + a * 4 > 0" and "a < 0" and "b \<le> 0" and "t \<ge> 0" and "s1 > 0"
  shows "0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 -
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) * s1 / sqrt (b\<^sup>2 + a * 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) * s1 / sqrt (b\<^sup>2 + a * 4)
[PROOF STEP]
proof(subst diff_divide_distrib[symmetric], simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have f0: "s1 / (2 * sqrt (b\<^sup>2 + a * 4)) > 0"  (is "s1/?c3 > 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
using assms(1,5)
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 + a * 4
0 < s1

goal (1 subgoal):
 1. 0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have f1: "(b - sqrt (b\<^sup>2 + 4 * a)) < (b + sqrt (b\<^sup>2 + 4 * a))" (is "?c2 < ?c1")
    and f2: "(b + sqrt (b\<^sup>2 + 4 * a)) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a) &&& b + sqrt (b\<^sup>2 + 4 * a) < 0
[PROOF STEP]
using sqrt_ge_absD[of b "b\<^sup>2 + 4 * a"] assms
[PROOF STATE]
proof (prove)
using this:
\<bar>b\<bar> \<le> sqrt (b\<^sup>2 + 4 * a) \<Longrightarrow> b\<^sup>2 \<le> b\<^sup>2 + 4 * a
0 < b\<^sup>2 + a * 4
a < 0
b \<le> 0
0 \<le> t
0 < s1

goal (1 subgoal):
 1. b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a) &&& b + sqrt (b\<^sup>2 + 4 * a) < 0
[PROOF STEP]
by (force, linarith)
[PROOF STATE]
proof (state)
this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
hence f3: "exp (t * ?c2 / 2) \<le> exp (t * ?c1 / 2)" (is "exp ?t1 \<le> exp ?t2")
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
unfolding exp_le_cancel_iff
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<le> t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0
0 \<le> t

goal (1 subgoal):
 1. t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<le> t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2
[PROOF STEP]
by (case_tac "t=0", simp_all)
[PROOF STATE]
proof (state)
this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
hence "?c2 * exp ?t2 \<le> ?c2 * exp ?t1"
[PROOF STATE]
proof (prove)
using this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1 f2 mult_le_cancel_left_pos[of "-?c2" "exp ?t1" "exp ?t2"]
[PROOF STATE]
proof (prove)
using this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0
0 < - (b - sqrt (b\<^sup>2 + 4 * a)) \<Longrightarrow> (- (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) = (exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2))

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have "... < ?c1 * exp ?t1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have"... \<le> ?c1 * exp ?t1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1 f2
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
show "0 \<le> (?c1 * exp ?t1 - ?c2 * exp ?t2) * s1 / ?c3"
[PROOF STATE]
proof (prove)
using this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
using f0 f1 assms(5)
[PROOF STATE]
proof (prove)
using this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
0 < s1

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upper_asymptotic_density_zero_union:
  assumes "upper_asymptotic_density A = 0" "upper_asymptotic_density B = 0"
  shows "upper_asymptotic_density (A \<union> B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
using upper_asymptotic_density_in_01(3)[of "A \<union> B"] upper_asymptotic_density_union[of A B]
[PROOF STATE]
proof (prove)
using this:
0 \<le> upper_asymptotic_density (A \<union> B)
upper_asymptotic_density (A \<union> B) \<le> upper_asymptotic_density A + upper_asymptotic_density B

goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> upper_asymptotic_density (A \<union> B)
upper_asymptotic_density (A \<union> B) \<le> 0 + 0

goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
by auto