[STATEMENT]
lemma bigo_lesso1: "\<forall>x. f x <= g x \<Longrightarrow> f <o g =o O(h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<le> g x \<Longrightarrow> f <o g \<in> O(h)
[PROOF STEP]
apply (unfold lesso_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<le> g x \<Longrightarrow> (\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h)
[PROOF STEP]
apply (subgoal_tac "(\<lambda>x. max (f x - g x) 0) = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>x. f x \<le> g x; (\<lambda>x. max (f x - g x) (0::'b)) = 0\<rbrakk> \<Longrightarrow> (\<lambda>x. max (f x - g x) (0::'b)) \<in> O(h)
 2. \<forall>x. f x \<le> g x \<Longrightarrow> (\<lambda>x. max (f x - g x) (0::'b)) = 0
[PROOF STEP]
apply (metis bigo_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<le> g x \<Longrightarrow> (\<lambda>x. max (f x - g x) (0::'b)) = 0
[PROOF STEP]
by (metis (lifting, no_types) func_zero le_fun_def le_iff_diff_le_0
      max.absorb2 order_eq_iff)


[STATEMENT]
lemma fk_estimate:
  assumes "as \<noteq> []"
  shows "length as * of_rat (F (2*k-1) as) \<le> n powr (1 - 1 / real k) * (of_rat (F k as))^2"
  (is "?lhs \<le> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
proof (cases "k \<ge> 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
2 \<le> k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
define M where "M = Max (count_list as ` set as)"
[PROOF STATE]
proof (state)
this:
M = Max (count_list as ` set as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "M \<in> count_list as ` set as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<in> count_list as ` set as
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (count_list as ` set as) \<in> count_list as ` set as
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []

goal (1 subgoal):
 1. Max (count_list as ` set as) \<in> count_list as ` set as
[PROOF STEP]
by (intro Max_in, auto)
[PROOF STATE]
proof (state)
this:
M \<in> count_list as ` set as

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M \<in> count_list as ` set as
[PROOF STEP]
obtain m where m_in: "m \<in> set as" and m_def: "M = count_list as m"
[PROOF STATE]
proof (prove)
using this:
M \<in> count_list as ` set as

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>m \<in> set as; M = count_list as m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m \<in> set as
M = count_list as m

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have a: "real M > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real M
[PROOF STEP]
using m_in count_list_gr_1
[PROOF STATE]
proof (prove)
using this:
m \<in> set as
(?x \<in> set ?xs) = (1 \<le> count_list ?xs ?x)

goal (1 subgoal):
 1. 0 < real M
[PROOF STEP]
by (simp add:m_def, force)
[PROOF STATE]
proof (state)
this:
0 < real M

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have b: "2*k-1 = (k-1) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * k - 1 = k - 1 + k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * k - 1 = k - 1 + k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have " 0 < real (count_list as m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real (count_list as m)
[PROOF STEP]
using m_in count_list_gr_1
[PROOF STATE]
proof (prove)
using this:
m \<in> set as
(?x \<in> set ?xs) = (1 \<le> count_list ?xs ?x)

goal (1 subgoal):
 1. 0 < real (count_list as m)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < real (count_list as m)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
hence "M powr k = real (count_list as m) ^ k"
[PROOF STATE]
proof (prove)
using this:
0 < real (count_list as m)

goal (1 subgoal):
 1. real M powr real k = real (count_list as m) ^ k
[PROOF STEP]
by (simp add: powr_realpow m_def)
[PROOF STATE]
proof (state)
this:
real M powr real k = real (count_list as m) ^ k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real M powr real k = real (count_list as m) ^ k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le> (\<Sum>x\<in>set as. real (count_list as x) ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (count_list as m) ^ k \<le> (\<Sum>x\<in>set as. real (count_list as x) ^ k)
[PROOF STEP]
using m_in
[PROOF STATE]
proof (prove)
using this:
m \<in> set as

goal (1 subgoal):
 1. real (count_list as m) ^ k \<le> (\<Sum>x\<in>set as. real (count_list as x) ^ k)
[PROOF STEP]
by (intro member_le_sum, simp_all)
[PROOF STATE]
proof (state)
this:
real (count_list as m) ^ k \<le> (\<Sum>x\<in>set as. real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (count_list as m) ^ k \<le> (\<Sum>x\<in>set as. real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le> real_of_rat (F k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set as. real (count_list as x) ^ k) \<le> real_of_rat (F k as)
[PROOF STEP]
by (simp add:F_def of_rat_sum of_rat_power)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. real (count_list as x) ^ k) \<le> real_of_rat (F k as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real M powr real k \<le> real_of_rat (F k as)
[PROOF STEP]
have d: "M powr k \<le> real_of_rat (F k as)"
[PROOF STATE]
proof (prove)
using this:
real M powr real k \<le> real_of_rat (F k as)

goal (1 subgoal):
 1. real M powr real k \<le> real_of_rat (F k as)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real M powr real k \<le> real_of_rat (F k as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have e: "0 \<le> real_of_rat (F k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_rat (F k as)
[PROOF STEP]
using F_gr_0[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
0 < F ?k as

goal (1 subgoal):
 1. 0 \<le> real_of_rat (F k as)
[PROOF STEP]
by (simp add: order_le_less)
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_rat (F k as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "real (k - 1) / real k + 1 = real (k - 1) / real k + real k / real k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) / real k + 1 = real (k - 1) / real k + real k / real k
[PROOF STEP]
using assms True
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []
2 \<le> k

goal (1 subgoal):
 1. real (k - 1) / real k + 1 = real (k - 1) / real k + real k / real k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (k - 1) / real k + 1 = real (k - 1) / real k + real k / real k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (k - 1) / real k + 1 = real (k - 1) / real k + real k / real k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... =  real (2 * k - 1) / real k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) / real k + real k / real k = real (2 * k - 1) / real k
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
2 * k - 1 = k - 1 + k

goal (1 subgoal):
 1. real (k - 1) / real k + real k / real k = real (2 * k - 1) / real k
[PROOF STEP]
by (subst add_divide_distrib[symmetric], force)
[PROOF STATE]
proof (state)
this:
real (k - 1) / real k + real k / real k = real (2 * k - 1) / real k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (k - 1) / real k + 1 = real (2 * k - 1) / real k
[PROOF STEP]
have f: "real (k - 1) / real k + 1 = real (2 * k - 1) / real k"
[PROOF STATE]
proof (prove)
using this:
real (k - 1) / real k + 1 = real (2 * k - 1) / real k

goal (1 subgoal):
 1. real (k - 1) / real k + 1 = real (2 * k - 1) / real k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (k - 1) / real k + 1 = real (2 * k - 1) / real k

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "real_of_rat (F (2*k-1) as) =
    (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (F (2 * k - 1) as) = (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
2 * k - 1 = k - 1 + k

goal (1 subgoal):
 1. real_of_rat (F (2 * k - 1) as) = (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k)
[PROOF STEP]
by (simp add:F_def of_rat_sum sum_distrib_left of_rat_mult power_add of_rat_power)
[PROOF STATE]
proof (state)
this:
real_of_rat (F (2 * k - 1) as) = (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_rat (F (2 * k - 1) as) = (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le> (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k) \<le> (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k)
[PROOF STEP]
by (intro sum_mono mult_right_mono power_mono of_nat_mono) (auto simp:M_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k) \<le> (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. real (count_list as x) ^ (k - 1) * real (count_list as x) ^ k) \<le> (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = M powr (k-1) * of_rat (F k as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k) = real M powr real (k - 1) * real_of_rat (F k as)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
0 < real M

goal (1 subgoal):
 1. (\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k) = real M powr real (k - 1) * real_of_rat (F k as)
[PROOF STEP]
by (simp add:sum_distrib_left F_def of_rat_mult of_rat_sum of_rat_power powr_realpow)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k) = real M powr real (k - 1) * real_of_rat (F k as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set as. real M ^ (k - 1) * real (count_list as x) ^ k) = real M powr real (k - 1) * real_of_rat (F k as)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = (M powr k) powr (real (k - 1) / real k) * of_rat (F k as) powr 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real M powr real (k - 1) * real_of_rat (F k as) = (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1
[PROOF STEP]
using e
[PROOF STATE]
proof (prove)
using this:
0 \<le> real_of_rat (F k as)

goal (1 subgoal):
 1. real M powr real (k - 1) * real_of_rat (F k as) = (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1
[PROOF STEP]
by (simp add:powr_powr)
[PROOF STATE]
proof (state)
this:
real M powr real (k - 1) * real_of_rat (F k as) = (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real M powr real (k - 1) * real_of_rat (F k as) = (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le>  (real_of_rat (F k as)) powr ((k-1)/k) * (real_of_rat (F k as) powr 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 \<le> real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
real M powr real k \<le> real_of_rat (F k as)

goal (1 subgoal):
 1. (real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 \<le> real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1
[PROOF STEP]
by (intro mult_right_mono powr_mono2, auto)
[PROOF STATE]
proof (state)
this:
(real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 \<le> real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real M powr real k) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 \<le> real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = (real_of_rat (F k as)) powr ((2*k-1) / k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 = real_of_rat (F k as) powr (real (2 * k - 1) / real k)
[PROOF STEP]
by (subst powr_add[symmetric], subst f, simp)
[PROOF STATE]
proof (state)
this:
real_of_rat (F k as) powr (real (k - 1) / real k) * real_of_rat (F k as) powr 1 = real_of_rat (F k as) powr (real (2 * k - 1) / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_rat (F (2 * k - 1) as) \<le> real_of_rat (F k as) powr (real (2 * k - 1) / real k)
[PROOF STEP]
have a: "real_of_rat (F (2*k-1) as) \<le> (real_of_rat (F k as)) powr ((2*k-1) / k)"
[PROOF STATE]
proof (prove)
using this:
real_of_rat (F (2 * k - 1) as) \<le> real_of_rat (F k as) powr (real (2 * k - 1) / real k)

goal (1 subgoal):
 1. real_of_rat (F (2 * k - 1) as) \<le> real_of_rat (F k as) powr (real (2 * k - 1) / real k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_rat (F (2 * k - 1) as) \<le> real_of_rat (F k as) powr (real (2 * k - 1) / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have g: "card (set as) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set as) \<le> n
[PROOF STEP]
using card_mono[OF _ as_range]
[PROOF STATE]
proof (prove)
using this:
finite {..<n} \<Longrightarrow> card (set as) \<le> card {..<n}

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

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "length as = abs (sum (\<lambda>x. real (count_list as x)) (set as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length as) = \<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar>
[PROOF STEP]
by (subst of_nat_sum[symmetric], simp add: sum_count_set)
[PROOF STATE]
proof (state)
this:
real (length as) = \<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar>

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (length as) = \<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar>

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le> card (set as) powr ((k-Suc 0)/k) *
    (sum (\<lambda>x. \<bar>real (count_list as x)\<bar> powr k) (set as)) powr (1/k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar> \<le> real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k)
[PROOF STEP]
using assms True
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []
2 \<le> k

goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar> \<le> real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k)
[PROOF STEP]
by (intro Holder_inequality_sum[where p="k/(k-1)" and q="k" and f="\<lambda>_.1", simplified])
     (auto simp add:algebra_simps add_divide_distrib[symmetric])
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar> \<le> real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>x\<in>set as. real (count_list as x)\<bar> \<le> real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = (card (set as)) powr ((k-1) / real k) * of_rat (F k as) powr (1/ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k) = real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
using real_count_list_pos
[PROOF STATE]
proof (prove)
using this:
?x \<in> set as \<Longrightarrow> 0 < real (count_list as ?x)

goal (1 subgoal):
 1. real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k) = real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
by (simp add:F_def of_rat_sum of_rat_power powr_realpow)
[PROOF STATE]
proof (state)
this:
real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k) = real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (set as)) powr (real (k - Suc 0) / real k) * (\<Sum>x\<in>set as. \<bar>real (count_list as x)\<bar> powr real k) powr (1 / real k) = real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = (card (set as)) powr (1 - 1 / real k) * of_rat (F k as) powr (1/ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k) = real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
using k_ge_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> k

goal (1 subgoal):
 1. real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k) = real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
by (subst of_nat_diff[OF k_ge_1], subst diff_divide_distrib, simp)
[PROOF STATE]
proof (state)
this:
real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k) = real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (set as)) powr (real (k - 1) / real k) * real_of_rat (F k as) powr (1 / real k) = real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... \<le> n powr (1 - 1 / real k) * of_rat (F k as) powr (1/ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
using k_ge_1 g
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
card (set as) \<le> n

goal (1 subgoal):
 1. real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
by (intro mult_right_mono powr_mono2, auto)
[PROOF STATE]
proof (state)
this:
real (card (set as)) powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (length as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
have h: "length as \<le> n powr (1 - 1 / real k) * of_rat (F k as) powr (1/real k)"
[PROOF STATE]
proof (prove)
using this:
real (length as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)

goal (1 subgoal):
 1. real (length as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (length as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have i:"1 / real k + real (2 * k - 1) / real k = real 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real k + real (2 * k - 1) / real k = real 2
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
2 \<le> k

goal (1 subgoal):
 1. 1 / real k + real (2 * k - 1) / real k = real 2
[PROOF STEP]
by (subst add_divide_distrib[symmetric], simp_all add:of_nat_diff)
[PROOF STATE]
proof (state)
this:
1 / real k + real (2 * k - 1) / real k = real 2

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "?lhs \<le> n powr (1 - 1/k) * of_rat (F k as) powr (1/k) * (of_rat (F k as)) powr ((2*k-1) / k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k)
[PROOF STEP]
using a h F_ge_0
[PROOF STATE]
proof (prove)
using this:
real_of_rat (F (2 * k - 1) as) \<le> real_of_rat (F k as) powr (real (2 * k - 1) / real k)
real (length as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k)
0 \<le> F ?k ?as

goal (1 subgoal):
 1. real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k)
[PROOF STEP]
by (intro mult_mono mult_nonneg_nonneg, auto)
[PROOF STATE]
proof (state)
this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k)

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k) = real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
using i F_gr_0[OF assms]
[PROOF STATE]
proof (prove)
using this:
1 / real k + real (2 * k - 1) / real k = real 2
0 < F ?k as

goal (1 subgoal):
 1. real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k) = real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
by (simp add:powr_add[symmetric] powr_realpow[symmetric])
[PROOF STATE]
proof (state)
this:
real n powr (1 - 1 / real k) * real_of_rat (F k as) powr (1 / real k) * real_of_rat (F k as) powr (real (2 * k - 1) / real k) = real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2

goal (2 subgoals):
 1. 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
 2. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2

goal (1 subgoal):
 1. real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 2 \<le> k

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "n = 0 \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = 0 \<Longrightarrow> False
[PROOF STEP]
using as_range assms
[PROOF STATE]
proof (prove)
using this:
set as \<subseteq> {..<n}
as \<noteq> []

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n = 0 \<Longrightarrow> False

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
hence "n > 0"
[PROOF STATE]
proof (prove)
using this:
n = 0 \<Longrightarrow> False

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

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "k = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = 1
[PROOF STEP]
using assms k_ge_1 False
[PROOF STATE]
proof (prove)
using this:
as \<noteq> []
1 \<le> k
\<not> 2 \<le> k

goal (1 subgoal):
 1. k = 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
k = 1

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
k = 1

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
have "length as = real_of_rat (F (Suc 0) as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (length as) = real_of_rat (F (Suc 0) as)
[PROOF STEP]
by (simp add:F_def sum_count_set of_nat_sum[symmetric] del:of_nat_sum)
[PROOF STATE]
proof (state)
this:
real (length as) = real_of_rat (F (Suc 0) as)

goal (1 subgoal):
 1. \<not> 2 \<le> k \<Longrightarrow> real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < n
k = 1
real (length as) = real_of_rat (F (Suc 0) as)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n
k = 1
real (length as) = real_of_rat (F (Suc 0) as)

goal (1 subgoal):
 1. real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2
[PROOF STEP]
by (simp add:power2_eq_square)
[PROOF STATE]
proof (state)
this:
real (length as) * real_of_rat (F (2 * k - 1) as) \<le> real n powr (1 - 1 / real k) * (real_of_rat (F k as))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma limit_mat_add:
  fixes X :: "nat \<Rightarrow> complex mat" and Y :: "nat \<Rightarrow> complex mat" and A :: "complex mat"
    and m :: nat and B :: "complex mat"
  assumes limX: "limit_mat X A m" and limY: "limit_mat Y B m"
  shows "limit_mat (\<lambda>k. X k + Y k) (A + B) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
have dimA: "A \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat m m
[PROOF STEP]
using limX limit_mat_def
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))

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

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
have dimB: "B \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat m m
[PROOF STEP]
using limY limit_mat_def
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))

goal (1 subgoal):
 1. B \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
have dimX: "\<And>n. X n \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
using limX
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m

goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. X n \<in> carrier_mat m m \<and> A \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j))

goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
have dimY: "\<And>n. Y n \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
using limY
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m

goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. Y n \<in> carrier_mat m m \<and> B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j))

goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Y ?n \<in> carrier_mat m m
[PROOF STEP]
have dimXAB: "\<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
using this:
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m
[PROOF STEP]
using dimA dimB dimX dimY
[PROOF STATE]
proof (prove)
using this:
Y ?n \<in> carrier_mat m m
A \<in> carrier_mat m m
B \<in> carrier_mat m m
X ?n \<in> carrier_mat m m
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
\<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
have "(\<And>i j. i < m \<Longrightarrow> j < m \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
assume i: "i < m" and j: "j < m"
[PROOF STATE]
proof (state)
this:
i < m
j < m

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. (X n) $$ (i, j)) \<longlonglongrightarrow> A$$(i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
using limX limit_mat_def i j
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))
i < m
j < m

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. (Y n) $$ (i, j)) \<longlonglongrightarrow> B$$(i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)
[PROOF STEP]
using limY limit_mat_def i j
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))
i < m
j < m

goal (1 subgoal):
 1. (\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
(\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. (X n)$$(i, j) + (Y n) $$ (i, j)) \<longlonglongrightarrow> (A$$(i, j) + B$$(i, j))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
(\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)
[PROOF STEP]
using tendsto_add[of "\<lambda>n. (X n) $$ (i, j)" "A $$ (i, j)"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j)
(\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j)
\<lbrakk>((\<lambda>n. X n $$ (i, j)) \<longlongrightarrow> A $$ (i, j)) ?F; (?g \<longlongrightarrow> ?b) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. X x $$ (i, j) + ?g x) \<longlongrightarrow> A $$ (i, j) + ?b) ?F

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
have "(X n + Y n) $$ (i, j) = (X n)$$(i, j) + (Y n) $$ (i, j)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X n + Y n) $$ (i, j) = X n $$ (i, j) + Y n $$ (i, j)
[PROOF STEP]
using i j dimX dimY index_add_mat(1)[of i "Y n" j "X n"]
[PROOF STATE]
proof (prove)
using this:
i < m
j < m
X ?n \<in> carrier_mat m m
Y ?n \<in> carrier_mat m m
\<lbrakk>i < dim_row (Y n); j < dim_col (Y n)\<rbrakk> \<Longrightarrow> (X n + Y n) $$ (i, j) = X n $$ (i, j) + Y n $$ (i, j)

goal (1 subgoal):
 1. (X n + Y n) $$ (i, j) = X n $$ (i, j) + Y n $$ (i, j)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(X ?n + Y ?n) $$ (i, j) = X ?n $$ (i, j) + Y ?n $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(X ?n + Y ?n) $$ (i, j) = X ?n $$ (i, j) + Y ?n $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
have "(A + B) $$ (i, j) = A$$(i, j) + B$$(i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) $$ (i, j) = A $$ (i, j) + B $$ (i, j)
[PROOF STEP]
using i j dimA dimB
[PROOF STATE]
proof (prove)
using this:
i < m
j < m
A \<in> carrier_mat m m
B \<in> carrier_mat m m

goal (1 subgoal):
 1. (A + B) $$ (i, j) = A $$ (i, j) + B $$ (i, j)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(A + B) $$ (i, j) = A $$ (i, j) + B $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)
(X ?n + Y ?n) $$ (i, j) = X ?n $$ (i, j) + Y ?n $$ (i, j)
(A + B) $$ (i, j) = A $$ (i, j) + B $$ (i, j)
[PROOF STEP]
show "(\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. X n $$ (i, j) + Y n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j) + B $$ (i, j)
(X ?n + Y ?n) $$ (i, j) = X ?n $$ (i, j) + Y ?n $$ (i, j)
(A + B) $$ (i, j) = A $$ (i, j) + B $$ (i, j)

goal (1 subgoal):
 1. (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A + B) $$ (?i, ?j)

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A + B) $$ (?i, ?j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A + B) $$ (?i, ?j)

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k + Y k) (A + B) m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A + B) $$ (?i, ?j)

goal (1 subgoal):
 1. \<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j))
[PROOF STEP]
using dimXAB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n + Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A + B) $$ (?i, ?j)
\<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n + Y n \<in> carrier_mat m m \<and> A + B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. (X n + Y n) $$ (i, j)) \<longlonglongrightarrow> (A + B) $$ (i, j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limit_mat (\<lambda>k. X k + Y k) (A + B) m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma meet_comm: "(x::'a::Finite_Meet_cpo) \<sqinter> y = y \<sqinter> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> y = y \<sqinter> x
[PROOF STEP]
unfolding meet_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>{x, y} = \<Sqinter>{y, x}
[PROOF STEP]
by (metis insert_commute)


[STATEMENT]
lemma hypreal_sqrt_gt_zero: "\<And>x. 0 < x \<Longrightarrow> 0 < ( *f* sqrt)(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> 0 < (*f* sqrt) x
[PROOF STEP]
by transfer (simp add: real_sqrt_gt_zero)


[STATEMENT]
lemma conv_normal_density_zero_mean:
  assumes [simp, arith]: "0 < \<sigma>" "0 < \<tau>"
  shows "(\<lambda>x. \<integral>\<^sup>+y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) =
    normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2))"  (is "?LHS = ?RHS")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
define \<sigma>' \<tau>' where "\<sigma>' = \<sigma>\<^sup>2" and "\<tau>' = \<tau>\<^sup>2"
[PROOF STATE]
proof (state)
this:
\<sigma>' = \<sigma>\<^sup>2
\<tau>' = \<tau>\<^sup>2

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<sigma>' = \<sigma>\<^sup>2
\<tau>' = \<tau>\<^sup>2
[PROOF STEP]
have [simp, arith]: "0 < \<sigma>'" "0 < \<tau>'"
[PROOF STATE]
proof (prove)
using this:
\<sigma>' = \<sigma>\<^sup>2
\<tau>' = \<tau>\<^sup>2

goal (1 subgoal):
 1. 0 < \<sigma>' &&& 0 < \<tau>'
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < \<sigma>'
0 < \<tau>'

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
let ?\<sigma> = "sqrt ((\<sigma>' * \<tau>') / (\<sigma>' + \<tau>'))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have sqrt: "(sqrt (2 * pi * (\<sigma>' + \<tau>')) * sqrt (2 * pi * (\<sigma>' * \<tau>') / (\<sigma>' + \<tau>'))) =
    (sqrt (2 * pi * \<sigma>') * sqrt (2 * pi * \<tau>'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 * pi * (\<sigma>' + \<tau>')) * sqrt (2 * pi * (\<sigma>' * \<tau>') / (\<sigma>' + \<tau>')) = sqrt (2 * pi * \<sigma>') * sqrt (2 * pi * \<tau>')
[PROOF STEP]
by (subst power_eq_iff_eq_base[symmetric, where n=2])
       (simp_all add: real_sqrt_mult[symmetric] power2_eq_square)
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi * (\<sigma>' + \<tau>')) * sqrt (2 * pi * (\<sigma>' * \<tau>') / (\<sigma>' + \<tau>')) = sqrt (2 * pi * \<sigma>') * sqrt (2 * pi * \<tau>')

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "?LHS =
    (\<lambda>x. \<integral>\<^sup>+y. ennreal((normal_density 0 (sqrt (\<sigma>' + \<tau>')) x) * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) ?\<sigma> y) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)
[PROOF STEP]
apply (intro ext nn_integral_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> space lborel \<Longrightarrow> ennreal (normal_density 0 \<sigma> (x - xa) * normal_density 0 \<tau> xa) = ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) xa)
[PROOF STEP]
apply (simp add: normal_density_def \<sigma>'_def[symmetric] \<tau>'_def[symmetric] sqrt mult_exp_exp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. - ((x - xa)\<^sup>2 / (2 * \<sigma>')) - xa\<^sup>2 / (2 * \<tau>') = - (x\<^sup>2 / (2 * \<sigma>' + 2 * \<tau>')) - (xa - \<tau>' * x / (\<sigma>' + \<tau>'))\<^sup>2 * (\<sigma>' + \<tau>') / (2 * (\<sigma>' * \<tau>'))
[PROOF STEP]
apply (simp add: divide_simps power2_eq_square)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. (- ((x - xa) * ((x - xa) * \<tau>')) - xa * xa * \<sigma>') * ((2 * \<sigma>' + 2 * \<tau>') * (\<sigma>' + \<tau>')) = - (x * x * ((\<sigma>' + \<tau>') * (2 * (\<sigma>' * \<tau>')))) - (xa * (\<sigma>' + \<tau>') - \<tau>' * x) * (xa * (\<sigma>' + \<tau>') - \<tau>' * x) * (2 * \<sigma>' + 2 * \<tau>')
[PROOF STEP]
apply (simp add: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "... =
    (\<lambda>x. (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+y. ennreal( normal_density (\<tau>\<^sup>2* x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) ?\<sigma> y) \<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+ y. ennreal (normal_density (\<tau>\<^sup>2 * x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)
[PROOF STEP]
by (subst nn_integral_cmult[symmetric])
       (auto simp: \<sigma>'_def \<tau>'_def normal_density_def ennreal_mult'[symmetric])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+ y. ennreal (normal_density (\<tau>\<^sup>2 * x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 (sqrt (\<sigma>' + \<tau>')) x * normal_density (\<tau>' * x / (\<sigma>' + \<tau>')) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+ y. ennreal (normal_density (\<tau>\<^sup>2 * x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel)

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "... = (\<lambda>x. (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+ y. ennreal (normal_density (\<tau>\<^sup>2 * x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by (subst nn_integral_eq_integral) (auto simp: normal_density_nonneg)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x) * \<integral>\<^sup>+ y. ennreal (normal_density (\<tau>\<^sup>2 * x / (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) (sqrt (\<sigma>' * \<tau>' / (\<sigma>' + \<tau>'))) y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma space_empty_eq_bot: "space a = {} \<longleftrightarrow> a = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (space a = {}) = (a = bot)
[PROOF STEP]
using space_empty[of a]
[PROOF STATE]
proof (prove)
using this:
space a = {} \<Longrightarrow> a = count_space {}

goal (1 subgoal):
 1. (space a = {}) = (a = bot)
[PROOF STEP]
by (auto intro!: measure_eqI)


[STATEMENT]
lemma plus_le_left_cancel_nowrap: "x \<le> x + y' \<Longrightarrow> x \<le> x + y \<Longrightarrow> x + y' < x + y \<longleftrightarrow> y' < y"
  for x y y' :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> x + y'; x \<le> x + y\<rbrakk> \<Longrightarrow> (x + y' < x + y) = (y' < y)
[PROOF STEP]
by uint_arith


[STATEMENT]
lemma finite_symcl_iff: "finite (R\<^sup>s) \<longleftrightarrow> finite R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (R\<^sup>s) = finite R
[PROOF STEP]
unfolding symcl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (R \<union> (\<lambda>(a, b). (b, a)) ` R) = finite R
[PROOF STEP]
by blast


[STATEMENT]
lemma bounded_open_segment:
    fixes a :: "'a::real_normed_vector" shows "bounded (open_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (open_segment a b)
[PROOF STEP]
by (rule bounded_subset [OF bounded_closed_segment segment_open_subset_closed])


[STATEMENT]
lemma Qp_ev_hom_pvar:
  assumes "i < n"
  shows "Qp_ev_hom n (pvar Q\<^sub>p i) = \<vv>\<^bsub>n, i\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_ev_hom n (pvar Q\<^sub>p i) = \<vv>\<^bsub>n, i\<^esub>
[PROOF STEP]
apply(rule function_ring_car_eqI[of _ n])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Qp_ev_hom n (pvar Q\<^sub>p i) \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. \<vv>\<^bsub>n, i\<^esub> \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 3. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> Qp_ev_hom n (pvar Q\<^sub>p i) a = \<vv>\<^bsub>n, i\<^esub> a
[PROOF STEP]
using assms Qp_ev_hom_closed' local.pvar_closed
[PROOF STATE]
proof (prove)
using this:
i < n
?f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]) \<Longrightarrow> Qp_ev_hom ?n ?f \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)
?i < ?n \<Longrightarrow> pvar Q\<^sub>p ?i \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>])

goal (3 subgoals):
 1. Qp_ev_hom n (pvar Q\<^sub>p i) \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. \<vv>\<^bsub>n, i\<^esub> \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 3. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> Qp_ev_hom n (pvar Q\<^sub>p i) a = \<vv>\<^bsub>n, i\<^esub> a
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<vv>\<^bsub>n, i\<^esub> \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> Qp_ev_hom n (pvar Q\<^sub>p i) a = \<vv>\<^bsub>n, i\<^esub> a
[PROOF STEP]
using Qp.var_in_car assms
[PROOF STATE]
proof (prove)
using this:
?i < ?n \<Longrightarrow> \<vv>\<^bsub>?n, ?i\<^esub> \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)
i < n

goal (2 subgoals):
 1. \<vv>\<^bsub>n, i\<^esub> \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
 2. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> Qp_ev_hom n (pvar Q\<^sub>p i) a = \<vv>\<^bsub>n, i\<^esub> a
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> Qp_ev_hom n (pvar Q\<^sub>p i) a = \<vv>\<^bsub>n, i\<^esub> a
[PROOF STEP]
unfolding Qp_ev_hom_def var_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> (\<lambda>q\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). eval_at_point Q\<^sub>p q (pvar Q\<^sub>p i)) a = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). x ! i) a
[PROOF STEP]
using assms eval_pvar
[PROOF STATE]
proof (prove)
using this:
i < n
\<lbrakk>?i < ?n; ?a \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> eval_at_point Q\<^sub>p ?a (pvar Q\<^sub>p ?i) = ?a ! ?i

goal (1 subgoal):
 1. \<And>a. a \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> (\<lambda>q\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). eval_at_point Q\<^sub>p q (pvar Q\<^sub>p i)) a = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). x ! i) a
[PROOF STEP]
by (metis (no_types, lifting) restrict_apply)


[STATEMENT]
lemma map_of_zip_map:
  "map_of (zip xs (map f xs)) = (\<lambda>x. if x \<in> set xs then Some (f x) else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of (zip xs (map f xs)) = (\<lambda>x. if x \<in> set xs then Some (f x) else None)
[PROOF STEP]
by (induct xs) (simp_all add: fun_eq_iff)


[STATEMENT]
lemma consistent_prv_LLq_Num_leq:
assumes consistent  "prv (LLq (Num m) (Num n))"
shows "m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
by (metis Num assms consistent_def LLq not_leq_prv_neg_LLq_Num num prv_neg_fls subsetCE)


[STATEMENT]
lemma lincomb_to_dvd_modulo:
  fixes u d
  defines "d \<equiv> degree u"
  assumes d: "d \<le> n"
      and lincomb: "lincomb_list c (factorization_lattice u (n-d) k) = g" (is "?l = ?r")
  shows "poly_mod.dvdm k u (poly_of_vec g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
let ?S = "sylvester_mat_sub d (n - d) u [:k:]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
define q where "q \<equiv> poly_of_vec (vec_first (vec n c) (n - d))"
[PROOF STATE]
proof (state)
this:
q \<equiv> poly_of_vec (vec_first (vec n c) (n - d))

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
define r where "r \<equiv> poly_of_vec (vec_last (vec n c) d)"
[PROOF STATE]
proof (state)
this:
r \<equiv> poly_of_vec (vec_last (vec n c) d)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
have "?l = ?S\<^sup>T *\<^sub>v vec n c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list c (factorization_lattice u (n - d) k) = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
apply (subst lincomb_list_as_mat_mult)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>w\<in>set (factorization_lattice u (n - d) k). dim_vec w = n
 2. mat_of_cols n (factorization_lattice u (n - d) k) *\<^sub>v vec (length (factorization_lattice u (n - d) k)) c = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
using d d_def
[PROOF STATE]
proof (prove)
using this:
d \<le> n
d \<equiv> degree u

goal (2 subgoals):
 1. \<forall>w\<in>set (factorization_lattice u (n - d) k). dim_vec w = n
 2. mat_of_cols n (factorization_lattice u (n - d) k) *\<^sub>v vec (length (factorization_lattice u (n - d) k)) c = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
apply (force simp:factorization_lattice_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n (factorization_lattice u (n - d) k) *\<^sub>v vec (length (factorization_lattice u (n - d) k)) c = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
apply (fold transpose_mat_of_rows)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_rows n (factorization_lattice u (n - d) k))\<^sup>T *\<^sub>v vec (length (factorization_lattice u (n - d) k)) c = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
using d d_def
[PROOF STATE]
proof (prove)
using this:
d \<le> n
d \<equiv> degree u

goal (1 subgoal):
 1. (mat_of_rows n (factorization_lattice u (n - d) k))\<^sup>T *\<^sub>v vec (length (factorization_lattice u (n - d) k)) c = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c
[PROOF STEP]
by (simp add: factorization_lattice_as_sylvester)
[PROOF STATE]
proof (state)
this:
lincomb_list c (factorization_lattice u (n - d) k) = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb_list c (factorization_lattice u (n - d) k) = (sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
have "poly_of_vec \<dots> = q * u + smult k r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_vec ((sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c) = q * u + smult k r
[PROOF STEP]
apply (subst sylvester_sub_poly)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. degree u \<le> d
 2. degree [:k:] \<le> n - d
 3. vec n c \<in> carrier_vec (d + (n - d))
 4. poly_of_vec (vec_first (vec n c) (n - d)) * u + poly_of_vec (vec_last (vec n c) d) * [:k:] = q * u + smult k r
[PROOF STEP]
using d_def d q_def r_def
[PROOF STATE]
proof (prove)
using this:
d \<equiv> degree u
d \<le> n
q \<equiv> poly_of_vec (vec_first (vec n c) (n - d))
r \<equiv> poly_of_vec (vec_last (vec n c) d)

goal (4 subgoals):
 1. degree u \<le> d
 2. degree [:k:] \<le> n - d
 3. vec n c \<in> carrier_vec (d + (n - d))
 4. poly_of_vec (vec_first (vec n c) (n - d)) * u + poly_of_vec (vec_last (vec n c) d) * [:k:] = q * u + smult k r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_of_vec ((sylvester_mat_sub d (n - d) u [:k:])\<^sup>T *\<^sub>v vec n c) = q * u + smult k r

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_of_vec (lincomb_list c (factorization_lattice u (n - d) k)) = q * u + smult k r
[PROOF STEP]
have "\<dots> = poly_of_vec g"
[PROOF STATE]
proof (prove)
using this:
poly_of_vec (lincomb_list c (factorization_lattice u (n - d) k)) = q * u + smult k r

goal (1 subgoal):
 1. q * u + smult k r = poly_of_vec g
[PROOF STEP]
unfolding lincomb of_int_hom.hom_poly_of_vec
[PROOF STATE]
proof (prove)
using this:
poly_of_vec g = q * u + smult k r

goal (1 subgoal):
 1. q * u + smult k r = poly_of_vec g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q * u + smult k r = poly_of_vec g

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q * u + smult k r = poly_of_vec g
[PROOF STEP]
have "poly_of_vec g = q * u + Polynomial.smult k r"
[PROOF STATE]
proof (prove)
using this:
q * u + smult k r = poly_of_vec g

goal (1 subgoal):
 1. poly_of_vec g = q * u + smult k r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_of_vec g = q * u + smult k r

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly_of_vec g = q * u + smult k r
[PROOF STEP]
have "poly_mod.Mp k (poly_of_vec g) =  poly_mod.Mp k (q * u + Polynomial.smult k r)"
[PROOF STATE]
proof (prove)
using this:
poly_of_vec g = q * u + smult k r

goal (1 subgoal):
 1. poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (q * u + smult k r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (q * u + smult k r)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (q * u + smult k r)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
have "... = poly_mod.Mp k (q * u + poly_mod.Mp k (Polynomial.smult k r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp k (q * u + smult k r) = poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r))
[PROOF STEP]
using poly_mod.plus_Mp(2)
[PROOF STATE]
proof (prove)
using this:
poly_mod.Mp ?m (?f + poly_mod.Mp ?m ?g) = poly_mod.Mp ?m (?f + ?g)

goal (1 subgoal):
 1. poly_mod.Mp k (q * u + smult k r) = poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (q * u + smult k r) = poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r))

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (q * u + smult k r) = poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r))

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
have "... =  poly_mod.Mp k (q * u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r)) = poly_mod.Mp k (q * u)
[PROOF STEP]
using poly_mod.plus_Mp(2)
[PROOF STATE]
proof (prove)
using this:
poly_mod.Mp ?m (?f + poly_mod.Mp ?m ?g) = poly_mod.Mp ?m (?f + ?g)

goal (1 subgoal):
 1. poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r)) = poly_mod.Mp k (q * u)
[PROOF STEP]
unfolding poly_mod.Mp_smult_m_0
[PROOF STATE]
proof (prove)
using this:
poly_mod.Mp ?m (?f + poly_mod.Mp ?m ?g) = poly_mod.Mp ?m (?f + ?g)

goal (1 subgoal):
 1. poly_mod.Mp k (q * u + 0) = poly_mod.Mp k (q * u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r)) = poly_mod.Mp k (q * u)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (q * u + poly_mod.Mp k (smult k r)) = poly_mod.Mp k (q * u)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
have "... = poly_mod.Mp k (u * q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp k (q * u) = poly_mod.Mp k (u * q)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
poly_mod.Mp k (q * u) = poly_mod.Mp k (u * q)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (u * q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (u * q)

goal (1 subgoal):
 1. poly_mod.dvdm k u (poly_of_vec g)
[PROOF STEP]
unfolding poly_mod.dvdm_def
[PROOF STATE]
proof (prove)
using this:
poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (u * q)

goal (1 subgoal):
 1. \<exists>h. poly_mod.Mp k (poly_of_vec g) = poly_mod.Mp k (u * h)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.dvdm k u (poly_of_vec g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma box_ne_empty:
  fixes a :: "'a::euclidean_space"
  shows "cbox a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i)"
  and "box a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cbox a b \<noteq> {}) = (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i) &&& (box a b \<noteq> {}) = (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)
[PROOF STEP]
unfolding box_eq_empty[of a b]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<exists>i\<in>Basis. b \<bullet> i < a \<bullet> i)) = (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i) &&& (\<not> (\<exists>i\<in>Basis. b \<bullet> i \<le> a \<bullet> i)) = (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)
[PROOF STEP]
by fastforce+


[STATEMENT]
lemma VectorSpaceEndI :
  fixes   smult :: "'f::field \<Rightarrow> 'v::ab_group_add \<Rightarrow> 'v"
  assumes "VectorSpaceHom smult V smult T" "T ` V \<subseteq> V"
  shows   "VectorSpaceEnd smult V T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceEnd smult V T
[PROOF STEP]
by      (rule VectorSpaceEnd.intro, rule assms(1), unfold_locales, rule assms(2))


[STATEMENT]
lemma mult_assoc_aux1:
 \<open>(\<lambda>(p, y). 10 ^ p * y) \<circ> (\<lambda>(a, y). (Suc a, y)) = (\<lambda>(p, y). (10::nat) * (10 ^ p) * y)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(p, y). 10 ^ p * y) \<circ> (\<lambda>(a, y). (Suc a, y)) = (\<lambda>(p, y). 10 * 10 ^ p * y)
[PROOF STEP]
by(auto simp:o_def)


[STATEMENT]
lemma powr_float_interval:
  "{x powr y | x y. x \<in> set_of (real_interval X) \<and> y \<in> set_of (real_interval Y)}
    \<subseteq> set_of (real_interval R)"
  if "powr_float_interval prec X Y = Some R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x powr y |x y. x \<in>\<^sub>r X \<and> y \<in>\<^sub>r Y} \<subseteq> set_of (real_interval R)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
powr_float_interval prec X Y = Some R

goal (1 subgoal):
 1. {x powr y |x y. x \<in>\<^sub>r X \<and> y \<in>\<^sub>r Y} \<subseteq> set_of (real_interval R)
[PROOF STEP]
by transfer (auto dest!: bnds_powr[OF sym])


[STATEMENT]
lemma ghomTr4:"\<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K\<rbrakk> \<Longrightarrow>
                  F \<guillemotright> (iim F G f K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K \<rbrakk> \<Longrightarrow> F \<guillemotright> iim F G f K
[PROOF STEP]
apply (rule Group.sg_condition[of "F" "iim F G f K"], assumption+,
       rule subsetI, simp add:iim_def,
       simp add:iim_nonempty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K \<rbrakk> \<Longrightarrow> \<forall>a b. a \<in> iim F G f K \<and> b \<in> iim F G f K \<longrightarrow> a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> iim F G f K
[PROOF STEP]
apply ((rule allI)+, rule impI, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> iim F G f K; b \<in> iim F G f K\<rbrakk> \<Longrightarrow> a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> iim F G f K
[PROOF STEP]
apply (simp add:iim_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> carrier F \<and> f a \<in> K; b \<in> carrier F \<and> f b \<in> K\<rbrakk> \<Longrightarrow> a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> carrier F \<and> f (a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b) \<in> K
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> carrier F; f a \<in> K; b \<in> carrier F; f b \<in> K\<rbrakk> \<Longrightarrow> a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> carrier F \<and> f (a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b) \<in> K
[PROOF STEP]
apply (frule_tac a = b in Group.i_closed[of "F"], assumption+,
       frule_tac a = a and b = "\<rho>\<^bsub>F\<^esub> b" in Group.mult_closed[of "F"],
        assumption+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> carrier F; f a \<in> K; b \<in> carrier F; f b \<in> K; \<rho>\<^bsub>F\<^esub> b \<in> carrier F; a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b) \<in> K
[PROOF STEP]
apply (simp add:gHom ghom_inv_inv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> carrier F; f a \<in> K; b \<in> carrier F; f b \<in> K; \<rho>\<^bsub>F\<^esub> b \<in> carrier F; a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<cdot>\<^bsub>G\<^esub> \<rho>\<^bsub>G\<^esub> f b \<in> K
[PROOF STEP]
apply (frule_tac x = "f b" in Group.sg_i_closed[of "G" "K"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>Group F; Group G; f \<in> gHom F G; G \<guillemotright> K ; a \<in> carrier F; f a \<in> K; b \<in> carrier F; f b \<in> K; \<rho>\<^bsub>F\<^esub> b \<in> carrier F; a \<cdot>\<^bsub>F\<^esub> \<rho>\<^bsub>F\<^esub> b \<in> carrier F; \<rho>\<^bsub>G\<^esub> f b \<in> K\<rbrakk> \<Longrightarrow> f a \<cdot>\<^bsub>G\<^esub> \<rho>\<^bsub>G\<^esub> f b \<in> K
[PROOF STEP]
apply (simp add:gHom_mem Group.sg_mult_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma butterfly_add_right: \<open>butterfly a (b + b') = butterfly a b + butterfly a b'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butterfly a (b + b') = butterfly a b + butterfly a b'
[PROOF STEP]
by (simp add: butterfly_def adj_plus vector_to_cblinfun_add cblinfun_compose_add_right)


[STATEMENT]
lemma fds_const_uminus [simp]:
  "fds_const (- b :: 'a :: ab_group_add) = - fds_const b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_const (- b) = - fds_const b
[PROOF STEP]
by (simp add: fds_eq_iff fds_nth_const)


[STATEMENT]
lemma of_nat_eq_size: "of_nat n = w \<longleftrightarrow> (\<exists>q. n = unat w + q * 2 ^ size w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_nat n = w) = (\<exists>q. n = unat w + q * 2 ^ size w)
[PROOF STEP]
unfolding word_size
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_nat n = w) = (\<exists>q. n = unat w + q * 2 ^ LENGTH('a))
[PROOF STEP]
by (rule of_nat_eq)


[STATEMENT]
lemma strong_formula_induct': "!A. (! B. size B < size A --> P B) --> P A ==> ! A. size A = n --> P (A::formula)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. (\<forall>B. size B < size A \<longrightarrow> P B) \<longrightarrow> P A \<Longrightarrow> \<forall>A. size A = n \<longrightarrow> P A
[PROOF STEP]
by (induct_tac n rule: nat_less_induct, blast)


[STATEMENT]
lemma check_prime_factors_subset_Cons [simp]:
  "check_prime_factors_subset (Suc 0) (p # ps) \<longleftrightarrow> check_prime_factors_subset (Suc 0) ps"
  "check_prime_factors_subset 1 (p # ps) \<longleftrightarrow> check_prime_factors_subset 1 ps"
  "p > 1 \<Longrightarrow> p dvd numeral n \<Longrightarrow> check_prime_factors_subset (numeral n) (p # ps) \<longleftrightarrow>
                           check_prime_factors_subset (numeral n div p) (p # ps)"
  "p \<le> 1 \<or> \<not>p dvd numeral n \<Longrightarrow> check_prime_factors_subset (numeral n) (p # ps) \<longleftrightarrow>
                           check_prime_factors_subset (numeral n) ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (check_prime_factors_subset (Suc 0) (p # ps) = check_prime_factors_subset (Suc 0) ps &&& check_prime_factors_subset 1 (p # ps) = check_prime_factors_subset 1 ps) &&& (\<lbrakk>1 < p; p dvd numeral n\<rbrakk> \<Longrightarrow> check_prime_factors_subset (numeral n) (p # ps) = check_prime_factors_subset (numeral n div p) (p # ps)) &&& (p \<le> 1 \<or> \<not> p dvd numeral n \<Longrightarrow> check_prime_factors_subset (numeral n) (p # ps) = check_prime_factors_subset (numeral n) ps)
[PROOF STEP]
by (subst check_prime_factors_subset.simps; force)+


[STATEMENT]
lemma hcmod_hrcis [simp]: "\<And>r a. hcmod(hrcis r a) = \<bar>r\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r a. hcmod (hrcis r a) = \<bar>r\<bar>
[PROOF STEP]
by transfer (rule complex_mod_rcis)


[STATEMENT]
lemma clinear_times_of_complex: "clinear (\<lambda>x. a * of_complex x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clinear (\<lambda>x. a * of_complex x)
[PROOF STEP]
by (auto intro!: clinearI simp: distrib_left)
    (metis mult_scaleC_right scaleC_conv_of_complex)


[STATEMENT]
lemma univ_wo: "well_order_on UNIV univ_order_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_order univ_order_rel
[PROOF STEP]
unfolding univ_order_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_order (SOME r. well_order r)
[PROOF STEP]
using well_order_on[of UNIV]
[PROOF STATE]
proof (prove)
using this:
\<exists>r. well_order r

goal (1 subgoal):
 1. well_order (SOME r. well_order r)
[PROOF STEP]
..


[STATEMENT]
lemma fbox_g_orbital_guard:
  assumes "H = (\<lambda>s. G s \<and> Q s)"
  shows "|x\<acute>=f & G on U S @ t\<^sub>0] Q = |x\<acute>=f & G on U S @ t\<^sub>0] H "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |x\<acute>=f & G on U S @ t\<^sub>0] Q = |x\<acute>=f & G on U S @ t\<^sub>0] H
[PROOF STEP]
unfolding fbox_g_orbital
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> Q (X t)) = (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> H (X t))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
H = (\<lambda>s. G s \<and> Q s)

goal (1 subgoal):
 1. (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> Q (X t)) = (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> H (X t))
[PROOF STEP]
by auto


[STATEMENT]
lemma cartesian_power_cons:
  assumes " as \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "a \<in> carrier R"
  shows "a#as \<in> carrier (R\<^bsup>n+1\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # as \<in> carrier (R\<^bsup>n + 1\<^esup>)
[PROOF STEP]
apply(rule cartesian_power_car_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (a # as) = n + 1
 2. set (a # as) \<subseteq> carrier R
[PROOF STEP]
apply (metis One_nat_def assms(1) cartesian_power_car_memE list.size(4))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (a # as) \<subseteq> carrier R
[PROOF STEP]
by (metis assms(1) assms(2) cartesian_power_car_memE cartesian_power_car_memE' in_set_conv_nth set_ConsD subsetI)


[STATEMENT]
lemma offset_poly_pCons:
  "offset_poly (pCons a p) h =
    smult h (offset_poly p h) + pCons a (offset_poly p h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset_poly (pCons a p) h = smult h (offset_poly p h) + pCons a (offset_poly p h)
[PROOF STEP]
by (cases "p = 0 \<and> a = 0") (auto simp add: offset_poly_def)


[STATEMENT]
lemma map2_index: "i < length xs \<Longrightarrow> i < length ys \<Longrightarrow> (map2 f xs ys) ! i = f (xs ! i) (ys ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length xs; i < length ys\<rbrakk> \<Longrightarrow> map2 f xs ys ! i = f (xs ! i) (ys ! i)
[PROOF STEP]
by (induction xs arbitrary: ys i) auto


[STATEMENT]
lemma real_is_int_def2: "real_is_int x = (x = real_of_int (int_of_real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_is_int x = (x = real_of_int (int_of_real x))
[PROOF STEP]
by (auto simp add: real_is_int_def int_of_real_def)


[STATEMENT]
lemma \<psi>\<^sub>1_values_even[simp]:
  fixes i j n
  assumes "i < dim_row (\<psi>\<^sub>1 n)" and "j < dim_col (\<psi>\<^sub>1 n)" and "even i"
  shows "(\<psi>\<^sub>1 n) $$ (i,j) = 1/(sqrt 2)^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))) $$ (i, j) = complex_of_real (1 / sqrt 2 ^ (n + 1))
[PROOF STEP]
using assms case_prod_conv
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))))
j < dim_col (Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))))
even i
(case (?a, ?b) of (c, d) \<Rightarrow> ?f c d) = ?f ?a ?b

goal (1 subgoal):
 1. Matrix.mat (2 ^ (n + 1)) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if even i then 1 / sqrt 2 ^ (n + 1) else - 1 / sqrt 2 ^ (n + 1))) $$ (i, j) = complex_of_real (1 / sqrt 2 ^ (n + 1))
[PROOF STEP]
by simp


[STATEMENT]
lemma hd_lq_conv_nth: assumes "u <p v" shows "hd(u\<inverse>\<^sup>>v) = v!\<^bold>|u\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (u\<inverse>\<^sup>>v) = v ! \<^bold>|u\<^bold>|
[PROOF STEP]
using prefix_length_less[OF assms, THEN hd_drop_conv_nth]
[PROOF STATE]
proof (prove)
using this:
hd (drop \<^bold>|u\<^bold>| v) = v ! \<^bold>|u\<^bold>|

goal (1 subgoal):
 1. hd (u\<inverse>\<^sup>>v) = v ! \<^bold>|u\<^bold>|
[PROOF STEP]
unfolding lq_drop[OF sprefD1[OF assms]]
[PROOF STATE]
proof (prove)
using this:
hd (drop \<^bold>|u\<^bold>| v) = v ! \<^bold>|u\<^bold>|

goal (1 subgoal):
 1. hd (drop \<^bold>|u\<^bold>| v) = v ! \<^bold>|u\<^bold>|
[PROOF STEP]
.


[STATEMENT]
lemma connectedD[intro?]:
  assumes "connected g" "u\<in>nodes g" "v\<in>nodes g"
  shows "(u,v)\<in>(edges g)\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Undirected_Graph.connected g
u \<in> nodes g
v \<in> nodes g

goal (1 subgoal):
 1. (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
unfolding connected_def
[PROOF STATE]
proof (prove)
using this:
nodes g \<times> nodes g \<subseteq> (edges g)\<^sup>*
u \<in> nodes g
v \<in> nodes g

goal (1 subgoal):
 1. (u, v) \<in> (edges g)\<^sup>*
[PROOF STEP]
by auto


[STATEMENT]
lemma length_Suc_rev_conv: "length xs = Suc n \<longleftrightarrow> (\<exists>ys y. xs=ys@[y] \<and> length ys = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs = Suc n) = (\<exists>ys y. xs = ys @ [y] \<and> length ys = n)
[PROOF STEP]
by (cases xs rule: rev_cases) auto


[STATEMENT]
lemma alt_group_mult: "mult (alt_group n) = (\<circ>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<otimes>\<^bsub>alt_group n\<^esub>) = (\<circ>)
[PROOF STEP]
unfolding alt_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<otimes>\<^bsub>sym_group n\<lparr>carrier := {p. p permutes {1..n} \<and> evenperm p}\<rparr>\<^esub>) = (\<circ>)
[PROOF STEP]
using sym_group_mult
[PROOF STATE]
proof (prove)
using this:
(\<otimes>\<^bsub>sym_group ?n\<^esub>) = (\<circ>)

goal (1 subgoal):
 1. (\<otimes>\<^bsub>sym_group n\<lparr>carrier := {p. p permutes {1..n} \<and> evenperm p}\<rparr>\<^esub>) = (\<circ>)
[PROOF STEP]
by simp


[STATEMENT]
lemma iT_Plus_Div_distrib_mod_less: "
  \<forall>x\<in>I. x mod m + n mod m < m \<Longrightarrow> I \<oplus> n \<oslash> m = I \<oslash> m \<oplus> n div m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>I. x mod m + n mod m < m \<Longrightarrow> I \<oplus> n \<oslash> m = I \<oslash> m \<oplus> n div m
[PROOF STEP]
by (simp add: set_eq_iff iT_Div_def iT_Plus_def image_image image_iff div_add1_eq1)


[STATEMENT]
lemma contour_integral_diff:
    "f1 contour_integrable_on g \<Longrightarrow> f2 contour_integrable_on g \<Longrightarrow> contour_integral g (\<lambda>x. f1 x - f2 x) =
                contour_integral g f1 - contour_integral g f2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f1 contour_integrable_on g; f2 contour_integrable_on g\<rbrakk> \<Longrightarrow> contour_integral g (\<lambda>x. f1 x - f2 x) = contour_integral g f1 - contour_integral g f2
[PROOF STEP]
by (simp add: contour_integral_unique has_contour_integral_integral has_contour_integral_diff)


[STATEMENT]
lemma sum_mset_mono:
  assumes "\<And>x. x \<in># A \<Longrightarrow> f x \<le> (g x :: 'a :: {ordered_ab_semigroup_add,comm_monoid_add})"
  shows   "(\<Sum>x\<in>#A. f x) \<le> (\<Sum>x\<in>#A. g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in># A \<Longrightarrow> f ?x \<le> g ?x

goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset g A)
[PROOF STEP]
by (induction A) (auto intro!: add_mono)


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