[STATEMENT]
lemma smcf_cn_comp_ObjMap_vrange:
  assumes "\<GG> : \<BB> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret L: is_semifunctor \<alpha> \<open>op_smc \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_smc \<BB> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
interpret R: is_semifunctor \<alpha> \<open>op_smc \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_smc \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule dghm_cn_comp_ObjMap_vrange
          [
            OF
              L.smcf_is_dghm[unfolded slicing_commute[symmetric]]
              R.smcf_is_dghm[unfolded slicing_commute[symmetric]],
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smcf_cn_comp_ObjMap_vsv[smc_cn_cs_intros]:
  assumes "\<GG> : \<BB> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)
[PROOF STEP]
interpret L: is_semifunctor \<alpha> \<open>op_smc \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_smc \<BB> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)
[PROOF STEP]
interpret R: is_semifunctor \<alpha> \<open>op_smc \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_smc \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)
[PROOF STEP]
by
      (
        rule dghm_cn_cov_comp_ObjMap_vsv
          [
            OF
              L.smcf_is_dghm[unfolded slicing_commute[symmetric]]
              R.smcf_is_dghm[unfolded slicing_commute[symmetric]],
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Ball_atLeast0LessThan_partition_by_conv:
  "(\<forall>i\<in>{0..<length ys}. \<forall>x\<in>set (partition_by xs ys ! i). P x) =
    (\<forall>x \<in> \<Union>(set (map set (partition_by xs ys))). P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>{0..<length ys}. \<forall>x\<in>set (partition_by xs ys ! i). P x) = (\<forall>x\<in>\<Union> (set (map set (partition_by xs ys))). P x)
[PROOF STEP]
by auto (metis atLeast0LessThan in_set_conv_nth length_partition_by lessThan_iff)


[STATEMENT]
lemma NR\<^sub>N_recurrence:
  assumes "0 < n" "p \<in> {0<..<1}"
  shows "NR\<^sub>N n u l = (p * (l + NR\<^sub>N (n - 1) u l) +
                     q * (u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * (pmf (binomial_pmf (n - 1) q) k))))
                     / (1 - (q ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
define B where "B = (\<lambda>n k. pmf (binomial_pmf n q) k)"
[PROOF STATE]
proof (state)
this:
B = (\<lambda>n. pmf (binomial_pmf n q))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have q: "q \<in> {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<in> {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. q \<in> {0<..<1}
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. 1 - p \<in> {0<..<1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q \<in> {0<..<1}
[PROOF STEP]
have "q ^ n < 1"
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. q ^ n < 1
[PROOF STEP]
using assms power_Suc_less_one
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}
0 < n
p \<in> {0<..<1}
\<lbrakk>(0::?'a) < ?a; ?a < (1::?'a)\<rbrakk> \<Longrightarrow> ?a ^ Suc ?n < (1::?'a)

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

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q ^ n < 1
[PROOF STEP]
have qn: "q ^ n \<in> {0<..<1}"
[PROOF STATE]
proof (prove)
using this:
q ^ n < 1

goal (1 subgoal):
 1. q ^ n \<in> {0<..<1}
[PROOF STEP]
using assms q
[PROOF STATE]
proof (prove)
using this:
q ^ n < 1
0 < n
p \<in> {0<..<1}
q \<in> {0<..<1}

goal (1 subgoal):
 1. q ^ n \<in> {0<..<1}
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
q ^ n \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "NR\<^sub>N n u l = p * (l + NR\<^sub>N (n - 1) u l) +
                    q * (u + \<integral>\<^sup>+ k. NR\<^sub>N (k + 1) u l  \<partial>measure_pmf (binomial_pmf (n - 1) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + \<integral>\<^sup>+ k. NR\<^sub>N (k + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + \<integral>\<^sup>+ k. NR\<^sub>N (k + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q))
[PROOF STEP]
unfolding NR\<^sub>N_def
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (R\<^sub>N n u l) = ennreal p * (of_nat l + \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (R\<^sub>N (n - 1) u l)) + ennreal q * (of_nat u + \<integral>\<^sup>+ k. \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (R\<^sub>N (k + 1) u l) \<partial>measure_pmf (binomial_pmf (n - 1) q))
[PROOF STEP]
by(subst R\<^sub>N_recurrence)
      (auto simp add: field_simps nn_integral_add q_def ennreal_of_nat_eq_real_of_nat)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + \<integral>\<^sup>+ k. NR\<^sub>N (k + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + \<integral>\<^sup>+ k. NR\<^sub>N (k + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "(\<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l  \<partial>measure_pmf (binomial_pmf (n - 1) q)) =
    (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * B (n - 1) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q) = (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q) = (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))
[PROOF STEP]
unfolding B_def q_def
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) (1 - p)) = (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) (1 - p)) k))
[PROOF STEP]
by (auto simp add: nn_integral_measure_pmf_finite)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q) = (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ m. NR\<^sub>N (m + 1) u l \<partial>measure_pmf (binomial_pmf (n - 1) q) = (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * B (n - 1) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) = (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))
[PROOF STEP]
by (rule sum.cong) (auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) = (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) = (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "\<dots> = (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * B (n - 1) k) + NR\<^sub>N n u l * q ^ (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) = (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + NR\<^sub>N n u l * ennreal (q ^ (n - 1))
[PROOF STEP]
unfolding B_def q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) (1 - p)) k)) = (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) (1 - p)) k)) + NR\<^sub>N n u l * ennreal ((1 - p) ^ (n - 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. (\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) (1 - p)) k)) = (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) (1 - p)) k)) + NR\<^sub>N n u l * ennreal ((1 - p) ^ (n - 1))
[PROOF STEP]
by (subst sum.union_disjoint) (auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{..<n - 1} \<union> {n - 1}. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) = (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + NR\<^sub>N n u l * ennreal (q ^ (n - 1))

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + NR\<^sub>N n u l * ennreal (q ^ (n - 1))))
[PROOF STEP]
have "NR\<^sub>N n u l = p * (l + NR\<^sub>N (n - 1) u l) +
                            q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * B (n - 1) k) + u) +
                            NR\<^sub>N n u l * (q ^ (n - 1)) * q"
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + NR\<^sub>N n u l * ennreal (q ^ (n - 1))))

goal (1 subgoal):
 1. NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + NR\<^sub>N n u l * ennreal (q ^ (n - 1))))
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q
[PROOF STEP]
by (auto simp add: field_simps numerals)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "NR\<^sub>N n u l * (q ^ (n - 1)) * q = (q ^ n) * NR\<^sub>N n u l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q = ennreal (q ^ n) * NR\<^sub>N n u l
[PROOF STEP]
using q power_minus_mult[of _ q] assms
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}
0 < ?n \<Longrightarrow> q ^ (?n - 1) * q = q ^ ?n
0 < n
p \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q = ennreal (q ^ n) * NR\<^sub>N n u l
[PROOF STEP]
by (subst mult_ac, subst ennreal_mult[symmetric], auto simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l * ennreal (q ^ (n - 1)) * ennreal q = ennreal (q ^ n) * NR\<^sub>N n u l

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + ennreal (q ^ n) * NR\<^sub>N n u l
[PROOF STEP]
have 1: "NR\<^sub>N n u l = p * (l + NR\<^sub>N (n - 1) u l) +
                               q * (u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * (B (n - 1) k))) +
                               (q ^ n) * NR\<^sub>N n u l "
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * ((\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)) + of_nat u) + ennreal (q ^ n) * NR\<^sub>N n u l

goal (1 subgoal):
 1. NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))) + ennreal (q ^ n) * NR\<^sub>N n u l
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))) + ennreal (q ^ n) * NR\<^sub>N n u l

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "x - z = y" if "x = y + z" "z \<noteq> \<top>" for x y z::ennreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - z = y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x = y + z
z \<noteq> \<top>

goal (1 subgoal):
 1. x - z = y
[PROOF STEP]
by (subst that) (auto)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x3 = ?y3 + ?z3; ?z3 \<noteq> \<top>\<rbrakk> \<Longrightarrow> ?x3 - ?z3 = ?y3

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "NR\<^sub>N n u l \<le> l * n + u * NH\<^sub>N n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
using NR\<^sub>N_bounds
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N ?n ?u ?l \<le> of_nat (?l * ?n) + of_nat ?u * NH\<^sub>N ?n

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
by (auto simp add: ennreal_of_nat_eq_real_of_nat)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "NH\<^sub>N n = EH\<^sub>N n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NH\<^sub>N n = ennreal (EH\<^sub>N n)
[PROOF STEP]
using assms NH\<^sub>N_EH\<^sub>N
[PROOF STATE]
proof (prove)
using this:
0 < n
p \<in> {0<..<1}
p \<in> {0<..<1} \<Longrightarrow> NH\<^sub>N ?n = ennreal (EH\<^sub>N ?n)

goal (1 subgoal):
 1. NH\<^sub>N n = ennreal (EH\<^sub>N n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
NH\<^sub>N n = ennreal (EH\<^sub>N n)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NH\<^sub>N n = ennreal (EH\<^sub>N n)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "(l * n) + u * ennreal (EH\<^sub>N n) < \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (l * n) + of_nat u * ennreal (EH\<^sub>N n) < \<top>
[PROOF STEP]
by (simp add: ennreal_mult_less_top of_nat_less_top)
[PROOF STATE]
proof (state)
this:
of_nat (l * n) + of_nat u * ennreal (EH\<^sub>N n) < \<top>

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N n u l < \<top>
[PROOF STEP]
have 3: "NR\<^sub>N n u l \<noteq> \<top>"
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l < \<top>

goal (1 subgoal):
 1. NR\<^sub>N n u l \<noteq> \<top>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l \<noteq> \<top>

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have 2: "x = y / (1 - a)" if "x = y + a * x" and t: "x \<noteq> \<top>" "a \<in> {0<..<1}" for x y::ennreal
          and a::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
have "y = x - a * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = x - ennreal a * x
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
x \<noteq> \<top>
a \<in> {0<..<1}

goal (1 subgoal):
 1. y = x - ennreal a * x
[PROOF STEP]
by (subst that) (auto simp add: ennreal_mult_eq_top_iff)
[PROOF STATE]
proof (state)
this:
y = x - ennreal a * x

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y = x - ennreal a * x

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
have "\<dots> = x * (ennreal 1 - ennreal a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - ennreal a * x = x * (ennreal 1 - ennreal a)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x = y + ennreal a * x
x \<noteq> \<top>
a \<in> {0<..<1}

goal (1 subgoal):
 1. x - ennreal a * x = x * (ennreal 1 - ennreal a)
[PROOF STEP]
by (auto simp add: mult_ac ennreal_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
x - ennreal a * x = x * (ennreal 1 - ennreal a)

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x - ennreal a * x = x * (ennreal 1 - ennreal a)

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
have "ennreal 1 - ennreal a = ennreal (1 - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal 1 - ennreal a = ennreal (1 - a)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x = y + ennreal a * x
x \<noteq> \<top>
a \<in> {0<..<1}

goal (1 subgoal):
 1. ennreal 1 - ennreal a = ennreal (1 - a)
[PROOF STEP]
by (subst ennreal_minus) (auto)
[PROOF STATE]
proof (state)
this:
ennreal 1 - ennreal a = ennreal (1 - a)

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal 1 - ennreal a = ennreal (1 - a)

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
have "x * (1 - a) / (1 - a) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * ennreal (1 - a) / ennreal (1 - a) = x
[PROOF STEP]
using that ennreal_minus_eq_0 not_less
[PROOF STATE]
proof (prove)
using this:
x = y + ennreal a * x
x \<noteq> \<top>
a \<in> {0<..<1}
?a - ?b = 0 \<Longrightarrow> ?a \<le> ?b
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. x * ennreal (1 - a) / ennreal (1 - a) = x
[PROOF STEP]
by (subst mult_divide_eq_ennreal) auto
[PROOF STATE]
proof (state)
this:
x * ennreal (1 - a) / ennreal (1 - a) = x

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
y / ennreal (1 - a) = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y / ennreal (1 - a) = x

goal (1 subgoal):
 1. x = y / ennreal (1 - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = y / ennreal (1 - a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x3 = ?y3 + ennreal ?a3 * ?x3; ?x3 \<noteq> \<top>; ?a3 \<in> {0<..<1}\<rbrakk> \<Longrightarrow> ?x3 = ?y3 / ennreal (1 - ?a3)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
have "NR\<^sub>N n u l = (p * (l + NR\<^sub>N (n - 1) u l) +
                     q * (u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * (B (n - 1) k))))
                   / (1 - (q ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
using 1 3 assms qn
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k))) + ennreal (q ^ n) * NR\<^sub>N n u l
NR\<^sub>N n u l \<noteq> \<top>
0 < n
p \<in> {0<..<1}
q ^ n \<in> {0<..<1}

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
by (intro 2) auto
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)))) / ennreal (1 - q ^ n)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (B (n - 1) k)))) / ennreal (1 - q ^ n)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)

goal (1 subgoal):
 1. NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = (ennreal p * (of_nat l + NR\<^sub>N (n - 1) u l) + ennreal q * (of_nat u + (\<Sum>k<n - 1. NR\<^sub>N (k + 1) u l * ennreal (pmf (binomial_pmf (n - 1) q) k)))) / ennreal (1 - q ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_lcm_least: "(\<And> x. x \<in> set xs \<Longrightarrow> x dvd y) \<Longrightarrow> list_lcm xs dvd y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> x dvd y) \<Longrightarrow> lcm_list xs dvd y
[PROOF STEP]
by (fact lcm_list_least)


[STATEMENT]
lemma sum_list_prod_map_aezfun_apply :
  "aezfun (\<Sum>(x,y)\<leftarrow>xys. f x y) a = (\<Sum>(x,y)\<leftarrow>xys. aezfun (f x y) a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aezfun (\<Sum>(x, y)\<leftarrow>xys. f x y) a = (\<Sum>(x, y)\<leftarrow>xys. aezfun (f x y) a)
[PROOF STEP]
by (induct xys) auto


[STATEMENT]
lemma Lim_bounded: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>M. f n \<le> C \<Longrightarrow> l \<le> C"
  for l :: "'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<longlonglongrightarrow> l; \<forall>n\<ge>M. f n \<le> C\<rbrakk> \<Longrightarrow> l \<le> C
[PROOF STEP]
by (intro LIMSEQ_le_const2) auto


[STATEMENT]
lemma eval_fm_Conj [simp]: "eval_fm e (Conj A B) \<longleftrightarrow> (eval_fm e A \<and> eval_fm e B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fm e (A AND B) = (eval_fm e A \<and> eval_fm e B)
[PROOF STEP]
by (auto simp: Conj_def)


[STATEMENT]
lemma indexed_Ints_vec_subset: "\<int>\<^sub>v \<subseteq> indexed_Ints_vec I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<int>\<^sub>v \<subseteq> indexed_Ints_vec I
[PROOF STEP]
unfolding Ints_vec_def indexed_Ints_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<forall>i<dim_vec x. x $ i \<in> \<int>} \<subseteq> {x. \<forall>i<dim_vec x. i \<in> I \<longrightarrow> x $ i \<in> \<int>}
[PROOF STEP]
by auto


[STATEMENT]
lemma log_mono: "a > 1 \<Longrightarrow> x \<le> y \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> log a y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; x \<le> y; 0 < x\<rbrakk> \<Longrightarrow> log a x \<le> log a y
[PROOF STEP]
by (subst log_le_cancel_iff, auto)


[STATEMENT]
lemma uniformly_continuous_on_dist[continuous_intros]:
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space"
  assumes "uniformly_continuous_on s f"
    and "uniformly_continuous_on s g"
  shows "uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
fix a b c d :: 'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
have "\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d
[PROOF STEP]
using dist_triangle2 [of a b c] dist_triangle2 [of b c d]
[PROOF STATE]
proof (prove)
using this:
dist a b \<le> dist a c + dist b c
dist b c \<le> dist b d + dist c d

goal (1 subgoal):
 1. \<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d
[PROOF STEP]
using dist_triangle3 [of c d a] dist_triangle [of a d b]
[PROOF STATE]
proof (prove)
using this:
dist a b \<le> dist a c + dist b c
dist b c \<le> dist b d + dist c d
dist c d \<le> dist a c + dist a d
dist a d \<le> dist a b + dist b d

goal (1 subgoal):
 1. \<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<bar>dist ?a2 ?b2 - dist ?c2 ?d2\<bar> \<le> dist ?a2 ?c2 + dist ?b2 ?d2

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
note le = this
[PROOF STATE]
proof (state)
this:
\<bar>dist ?a2 ?b2 - dist ?c2 ?d2\<bar> \<le> dist ?a2 ?c2 + dist ?b2 ?d2

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<bar>dist ?a2 ?b2 - dist ?c2 ?d2\<bar> \<le> dist ?a2 ?c2 + dist ?b2 ?d2

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
assume f: "(\<lambda>n. dist (f (x n)) (f (y n))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (state)
this:
(\<lambda>n. dist (f (x n)) (f (y n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
assume g: "(\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (state)
this:
(\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
have "(\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule Lim_transform_bound [OF _ tendsto_add_zero [OF f g]],
        simp add: le)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0
uniformly_continuous_on s f
uniformly_continuous_on s g

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
unfolding uniformly_continuous_on_sequentially
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (f (x n)) (f (y n))) \<longlonglongrightarrow> 0
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (dist (f (x n)) (g (x n))) (dist (f (y n)) (g (y n)))) \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding dist_real_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(\<lambda>n. dist (f (?x2 n)) (f (?y2 n))) \<longlonglongrightarrow> 0; (\<lambda>n. dist (g (?x2 n)) (g (?y2 n))) \<longlonglongrightarrow> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. \<bar>dist (f (?x2 n)) (g (?x2 n)) - dist (f (?y2 n)) (g (?y2 n))\<bar>) \<longlonglongrightarrow> 0
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (f (x n)) (f (y n))) \<longlonglongrightarrow> 0
\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (g (x n)) (g (y n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) \<longlonglongrightarrow> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tpart1_su:
assumes "tinfinite V"  shows "tpart1 V \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tpart1 V \<subseteq> V
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
tinfinite V

goal (1 subgoal):
 1. tpart1 V \<subseteq> V
[PROOF STEP]
unfolding tinfinite_def tpart1_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<sigma>. infinite (V \<inter> tpOfV -` {\<sigma>})

goal (1 subgoal):
 1. (\<Union>\<sigma>. part1 (V \<inter> tpOfV -` {\<sigma>})) \<subseteq> V
[PROOF STEP]
using part1_su
[PROOF STATE]
proof (prove)
using this:
\<forall>\<sigma>. infinite (V \<inter> tpOfV -` {\<sigma>})
infinite ?V \<Longrightarrow> part1 ?V \<subseteq> ?V

goal (1 subgoal):
 1. (\<Union>\<sigma>. part1 (V \<inter> tpOfV -` {\<sigma>})) \<subseteq> V
[PROOF STEP]
by (auto intro: UN_least)


[STATEMENT]
lemma rel_cset_cUNION:
  "\<lbrakk> rel_cset Q A B; rel_fun Q (rel_cset R) f g \<rbrakk>
  \<Longrightarrow> rel_cset R (cUnion (cimage f A)) (cUnion (cimage g B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rel_cset Q A B; rel_fun Q (rel_cset R) f g\<rbrakk> \<Longrightarrow> rel_cset R (cUnion (cimage f A)) (cUnion (cimage g B))
[PROOF STEP]
unfolding rel_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>rel_cset Q A B; \<forall>x y. Q x y \<longrightarrow> rel_cset R (f x) (g y)\<rbrakk> \<Longrightarrow> rel_cset R (cUnion (cimage f A)) (cUnion (cimage g B))
[PROOF STEP]
by transfer(erule rel_set_UNION, simp add: rel_fun_def)


[STATEMENT]
lemma mset_zip_take_Cons_drop_twice:
  assumes "length xs = length ys" "j \<le> length xs"
  shows "mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) =
    add_mset (x,y) (mset (zip xs ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
j \<le> length xs

goal (1 subgoal):
 1. mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys))
[PROOF STEP]
proof (induct xs ys arbitrary: x y j rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y j. j \<le> length [] \<Longrightarrow> mset (zip (take j [] @ x # drop j []) (take j [] @ y # drop j [])) = add_mset (x, y) (mset (zip [] []))
 2. \<And>x xs y ys xa ya j. \<lbrakk>length xs = length ys; \<And>x y j. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (x # xs)\<rbrakk> \<Longrightarrow> mset (zip (take j (x # xs) @ xa # drop j (x # xs)) (take j (y # ys) @ ya # drop j (y # ys))) = add_mset (xa, ya) (mset (zip (x # xs) (y # ys)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
j \<le> length []

goal (2 subgoals):
 1. \<And>x y j. j \<le> length [] \<Longrightarrow> mset (zip (take j [] @ x # drop j []) (take j [] @ y # drop j [])) = add_mset (x, y) (mset (zip [] []))
 2. \<And>x xs y ys xa ya j. \<lbrakk>length xs = length ys; \<And>x y j. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (x # xs)\<rbrakk> \<Longrightarrow> mset (zip (take j (x # xs) @ xa # drop j (x # xs)) (take j (y # ys) @ ya # drop j (y # ys))) = add_mset (xa, ya) (mset (zip (x # xs) (y # ys)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
j \<le> length []

goal (1 subgoal):
 1. mset (zip (take j [] @ x # drop j []) (take j [] @ y # drop j [])) = add_mset (x, y) (mset (zip [] []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (zip (take j [] @ x # drop j []) (take j [] @ y # drop j [])) = add_mset (x, y) (mset (zip [] []))

goal (1 subgoal):
 1. \<And>x xs y ys xa ya j. \<lbrakk>length xs = length ys; \<And>x y j. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (x # xs)\<rbrakk> \<Longrightarrow> mset (zip (take j (x # xs) @ xa # drop j (x # xs)) (take j (y # ys) @ ya # drop j (y # ys))) = add_mset (xa, ya) (mset (zip (x # xs) (y # ys)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys xa ya j. \<lbrakk>length xs = length ys; \<And>x y j. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (x # xs)\<rbrakk> \<Longrightarrow> mset (zip (take j (x # xs) @ xa # drop j (x # xs)) (take j (y # ys) @ ya # drop j (y # ys))) = add_mset (xa, ya) (mset (zip (x # xs) (y # ys)))
[PROOF STEP]
case (Cons x xs y ys)
[PROOF STATE]
proof (state)
this:
length xs = length ys
?j \<le> length xs \<Longrightarrow> mset (zip (take ?j xs @ ?x # drop ?j xs) (take ?j ys @ ?y # drop ?j ys)) = add_mset (?x, ?y) (mset (zip xs ys))
j \<le> length (xa__ # xs)

goal (1 subgoal):
 1. \<And>x xs y ys xa ya j. \<lbrakk>length xs = length ys; \<And>x y j. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (x # xs)\<rbrakk> \<Longrightarrow> mset (zip (take j (x # xs) @ xa # drop j (x # xs)) (take j (y # ys) @ ya # drop j (y # ys))) = add_mset (xa, ya) (mset (zip (x # xs) (y # ys)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length xs = length ys
?j \<le> length xs \<Longrightarrow> mset (zip (take ?j xs @ ?x # drop ?j xs) (take ?j ys @ ?y # drop ?j ys)) = add_mset (?x, ?y) (mset (zip xs ys))
j \<le> length (xa__ # xs)

goal (1 subgoal):
 1. mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
proof (cases "j = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j = 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
 2. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
j = 0

goal (2 subgoals):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j = 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
 2. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
j = 0

goal (1 subgoal):
 1. mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))

goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
j \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> 0
[PROOF STEP]
obtain k where k: "j = Suc k"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0

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

goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
hence "k \<le> length xs"
[PROOF STATE]
proof (prove)
using this:
j = Suc k

goal (1 subgoal):
 1. k \<le> length xs
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
j = Suc k
j \<le> length (xa__ # xs)

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

goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
hence "mset (zip (take k xs @ x # drop k xs) (take k ys @ y # drop k ys)) =
      add_mset (x,y) (mset (zip xs ys))"
[PROOF STATE]
proof (prove)
using this:
k \<le> length xs

goal (1 subgoal):
 1. mset (zip (take k xs @ x # drop k xs) (take k ys @ y # drop k ys)) = add_mset (x, y) (mset (zip xs ys))
[PROOF STEP]
by (rule Cons.hyps(2))
[PROOF STATE]
proof (state)
this:
mset (zip (take k xs @ x # drop k xs) (take k ys @ y # drop k ys)) = add_mset (x, y) (mset (zip xs ys))

goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>j x y. j \<le> length xs \<Longrightarrow> mset (zip (take j xs @ x # drop j xs) (take j ys @ y # drop j ys)) = add_mset (x, y) (mset (zip xs ys)); j \<le> length (xa__ # xs); j \<noteq> 0\<rbrakk> \<Longrightarrow> mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mset (zip (take k xs @ x # drop k xs) (take k ys @ y # drop k ys)) = add_mset (x, y) (mset (zip xs ys))

goal (1 subgoal):
 1. mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
unfolding k
[PROOF STATE]
proof (prove)
using this:
mset (zip (take k xs @ x # drop k xs) (take k ys @ y # drop k ys)) = add_mset (x, y) (mset (zip xs ys))

goal (1 subgoal):
 1. mset (zip (take (Suc k) (xa__ # xs) @ x # drop (Suc k) (xa__ # xs)) (take (Suc k) (ya__ # ys) @ y # drop (Suc k) (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mset (zip (take j (xa__ # xs) @ x # drop j (xa__ # xs)) (take j (ya__ # ys) @ y # drop j (ya__ # ys))) = add_mset (x, y) (mset (zip (xa__ # xs) (ya__ # ys)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_powr_bound2:
  fixes x :: real
  assumes "1 < x" and "0 < a"
  shows "(ln x) powr a \<le> (a powr a) * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 < x
0 < a
[PROOF STEP]
have "ln x \<le> (x powr (1 / a)) / (1 / a)"
[PROOF STATE]
proof (prove)
using this:
1 < x
0 < a

goal (1 subgoal):
 1. ln x \<le> x powr (1 / a) / (1 / a)
[PROOF STEP]
by (metis less_eq_real_def ln_powr_bound zero_less_divide_1_iff)
[PROOF STATE]
proof (state)
this:
ln x \<le> x powr (1 / a) / (1 / a)

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln x \<le> x powr (1 / a) / (1 / a)

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
have "\<dots> = a * (x powr (1 / a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr (1 / a) / (1 / a) = a * x powr (1 / a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x powr (1 / a) / (1 / a) = a * x powr (1 / a)

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln x \<le> a * x powr (1 / a)
[PROOF STEP]
have "(ln x) powr a \<le> (a * (x powr (1 / a))) powr a"
[PROOF STATE]
proof (prove)
using this:
ln x \<le> a * x powr (1 / a)

goal (1 subgoal):
 1. ln x powr a \<le> (a * x powr (1 / a)) powr a
[PROOF STEP]
by (metis assms less_imp_le ln_gt_zero powr_mono2)
[PROOF STATE]
proof (state)
this:
ln x powr a \<le> (a * x powr (1 / a)) powr a

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln x powr a \<le> (a * x powr (1 / a)) powr a

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
have "\<dots> = (a powr a) * ((x powr (1 / a)) powr a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * x powr (1 / a)) powr a = a powr a * (x powr (1 / a)) powr a
[PROOF STEP]
using assms powr_mult
[PROOF STATE]
proof (prove)
using this:
1 < x
0 < a
\<lbrakk>0 \<le> ?x; 0 \<le> ?y\<rbrakk> \<Longrightarrow> (?x * ?y) powr ?a = ?x powr ?a * ?y powr ?a

goal (1 subgoal):
 1. (a * x powr (1 / a)) powr a = a powr a * (x powr (1 / a)) powr a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a * x powr (1 / a)) powr a = a powr a * (x powr (1 / a)) powr a

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a * x powr (1 / a)) powr a = a powr a * (x powr (1 / a)) powr a

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
have "(x powr (1 / a)) powr a = x powr ((1 / a) * a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x powr (1 / a)) powr a = x powr (1 / a * a)
[PROOF STEP]
by (rule powr_powr)
[PROOF STATE]
proof (state)
this:
(x powr (1 / a)) powr a = x powr (1 / a * a)

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x powr (1 / a)) powr a = x powr (1 / a * a)

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
have "\<dots> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr (1 / a * a) = x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < x
0 < a

goal (1 subgoal):
 1. x powr (1 / a * a) = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x powr (1 / a * a) = x

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln x powr a \<le> a powr a * x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ln x powr a \<le> a powr a * x

goal (1 subgoal):
 1. ln x powr a \<le> a powr a * x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln x powr a \<le> a powr a * x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partition_Image_element:
  assumes "equiv A r" and "X \<in> A//r" and "x \<in> X"
  shows "r``{x} = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r `` {x} = X
[PROOF STEP]
by (metis Image_singleton_iff assms equiv_class_eq_iff quotientE)


[STATEMENT]
lemma sum_divisors_moebius_mu_times_multiplicative:
  fixes f :: "nat \<Rightarrow> 'a :: {comm_ring_1}"
  assumes "multiplicative_function f" "n > 0"
  shows   "(\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. 1 - f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
define g where "g = (\<lambda>n. \<Sum>d | d dvd n. moebius_mu d * f d)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>n. \<Sum>d | d dvd n. moebius_mu d * f d)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
define g' where "g' = dirichlet_prod (\<lambda>n. moebius_mu n * f n) (\<lambda>n. if n = 0 then 0 else 1)"
[PROOF STATE]
proof (state)
this:
g' = dirichlet_prod (\<lambda>n. moebius_mu n * f n) (\<lambda>n. if n = 0 then 0::'a else (1::'a))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
interpret f: multiplicative_function f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
have "multiplicative_function (\<lambda>n. if n = 0 then 0 else 1 :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (\<lambda>n. if n = 0 then 0::'a else (1::'a))
[PROOF STEP]
by standard auto
[PROOF STATE]
proof (state)
this:
multiplicative_function (\<lambda>n. if n = 0 then 0::'a else (1::'a))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
interpret multiplicative_function g'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function g'
[PROOF STEP]
unfolding g'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicative_function (dirichlet_prod (\<lambda>n. moebius_mu n * f n) (\<lambda>n. if n = 0 then 0::'a else (1::'a)))
[PROOF STEP]
by (intro multiplicative_dirichlet_prod multiplicative_function_mult
              moebius_mu.multiplicative_function_axioms assms) fact+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
have g'_primepow: "g' (p ^ k) = 1 - f p" if "prime p" "k > 0" for p k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
have "g' (p ^ k) = (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g' (p ^ k) = (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k

goal (1 subgoal):
 1. g' (p ^ k) = (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i))
[PROOF STEP]
by (simp add: g'_def dirichlet_prod_prime_power)
[PROOF STATE]
proof (state)
this:
g' (p ^ k) = (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i))

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g' (p ^ k) = (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i))

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i)) = (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k

goal (1 subgoal):
 1. (\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i)) = (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i))
[PROOF STEP]
by (intro sum.mono_neutral_right) (auto simp: moebius_mu_power')
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i)) = (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i))

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>k. moebius_mu (p ^ i) * f (p ^ i)) = (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i))

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
have "\<dots> = 1 - f p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i)) = (1::'a) - f p
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
prime p
0 < k

goal (1 subgoal):
 1. (\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i)) = (1::'a) - f p
[PROOF STEP]
by (simp add: moebius_mu.prime)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{0, 1}. moebius_mu (p ^ i) * f (p ^ i)) = (1::'a) - f p

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g' (p ^ k) = (1::'a) - f p

goal (1 subgoal):
 1. g' (p ^ k) = (1::'a) - f p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
g' (p ^ k) = (1::'a) - f p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>prime ?p; 0 < ?k\<rbrakk> \<Longrightarrow> g' (?p ^ ?k) = (1::'a) - f ?p

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
have "g' n = g n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g' n = g n
[PROOF STEP]
by (simp add: g_def g'_def dirichlet_prod_def)
[PROOF STATE]
proof (state)
this:
g' n = g n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g' n = g n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
multiplicative_function f
0 < n
[PROOF STEP]
have "g' n = (\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n))"
[PROOF STATE]
proof (prove)
using this:
multiplicative_function f
0 < n

goal (1 subgoal):
 1. g' n = (\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n))
[PROOF STEP]
by (intro prod_prime_factors) auto
[PROOF STATE]
proof (state)
this:
g' n = (\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g' n = (\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n))

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
have "\<dots> = (\<Prod>p\<in>prime_factors n. 1 - f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n)) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
by (intro prod.cong) (auto simp: g'_primepow prime_factors_multiplicity)
[PROOF STATE]
proof (state)
this:
(\<Prod>p\<in>prime_factors n. g' (p ^ multiplicity p n)) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>p\<in>prime_factors n. (1::'a) - f p) = g n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Prod>p\<in>prime_factors n. (1::'a) - f p) = g n

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)
[PROOF STEP]
by (simp add: g_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. moebius_mu d * f d) = (\<Prod>p\<in>prime_factors n. (1::'a) - f p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_mono_exceeds:
  assumes f: "strict_mono (f::nat \<Rightarrow> nat)"
  shows "\<exists>k. n < f k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. n < f k
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>k. 0 < f k
 2. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
strict_mono f
[PROOF STEP]
have "f 0 < f 1"
[PROOF STATE]
proof (prove)
using this:
strict_mono f

goal (1 subgoal):
 1. f 0 < f 1
[PROOF STEP]
by (rule strict_monoD) simp
[PROOF STATE]
proof (state)
this:
f 0 < f 1

goal (2 subgoals):
 1. \<exists>k. 0 < f k
 2. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
hence "0 < f 1"
[PROOF STATE]
proof (prove)
using this:
f 0 < f 1

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

goal (2 subgoals):
 1. \<exists>k. 0 < f k
 2. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
thus "\<exists>k. 0 < f k"
[PROOF STATE]
proof (prove)
using this:
0 < f 1

goal (1 subgoal):
 1. \<exists>k. 0 < f k
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>k. 0 < f k

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
assume "\<exists>k. n < f k"
[PROOF STATE]
proof (state)
this:
\<exists>k. n < f k

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. n < f k
[PROOF STEP]
obtain k where "n < f k"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. n < f k

goal (1 subgoal):
 1. (\<And>k. n < f k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
n < f k

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
hence "Suc n \<le> f k"
[PROOF STATE]
proof (prove)
using this:
n < f k

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

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc n \<le> f k

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
strict_mono f
[PROOF STEP]
have "f k < f (Suc k)"
[PROOF STATE]
proof (prove)
using this:
strict_mono f

goal (1 subgoal):
 1. f k < f (Suc k)
[PROOF STEP]
by (rule strict_monoD) simp
[PROOF STATE]
proof (state)
this:
f k < f (Suc k)

goal (1 subgoal):
 1. \<And>n. \<exists>k. n < f k \<Longrightarrow> \<exists>k. Suc n < f k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc n < f (Suc k)
[PROOF STEP]
show "\<exists>k. Suc n < f k"
[PROOF STATE]
proof (prove)
using this:
Suc n < f (Suc k)

goal (1 subgoal):
 1. \<exists>k. Suc n < f k
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>k. Suc n < f k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fref_weaken_pre:
    assumes "\<And>x. P x \<longrightarrow> P' x"
    assumes "(f,h) \<in> fref P' R S"
    shows "(f,h) \<in> fref P R S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f, h) \<in> [P]\<^sub>f R \<rightarrow> S
[PROOF STEP]
apply (rule rev_subsetD[OF assms(2) fref_mono])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. P x \<Longrightarrow> P' x
 2. R \<subseteq> R
 3. S \<subseteq> S
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
P ?x \<longrightarrow> P' ?x

goal (3 subgoals):
 1. \<And>x. P x \<Longrightarrow> P' x
 2. R \<subseteq> R
 3. S \<subseteq> S
[PROOF STEP]
by auto


[STATEMENT]
lemma arctan_bounds:
  assumes "0 \<le> x" "x < 1"
  shows arctan_lower_bound:
    "(\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x"
    (is "(\<Sum>k<_. (- 1)^ k * ?a k) \<le> _")
    and arctan_upper_bound:
    "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x &&& arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x
 2. arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have tendsto_zero: "?a \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule tendsto_eq_rhs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> ?x
 2. ?x = 0
[PROOF STEP]
show "(\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x < 1

goal (1 subgoal):
 1. (\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0
[PROOF STEP]
by (intro tendsto_mult real_tendsto_divide_at_top)
        (auto simp: filterlim_real_sequentially filterlim_sequentially_iff_filterlim_real
          intro!: real_tendsto_divide_at_top tendsto_power_zero filterlim_real_sequentially
          tendsto_eq_intros filterlim_at_top_mult_tendsto_pos filterlim_tendsto_add_at_top)
[PROOF STATE]
proof (state)
this:
(\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0 * 0

goal (1 subgoal):
 1. 0 * 0 = 0
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
(\<lambda>k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x
 2. arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have nonneg: "0 \<le> ?a n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by (force intro!: divide_nonneg_nonneg mult_nonneg_nonneg zero_le_power assms)
[PROOF STATE]
proof (state)
this:
0 \<le> 1 / real (?n * 2 + 1) * x ^ (?n * 2 + 1)

goal (2 subgoals):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x
 2. arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have le: "?a (Suc n) \<le> ?a n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real (Suc n * 2 + 1) * x ^ (Suc n * 2 + 1) \<le> 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by (rule mult_mono[OF _ power_decreasing]) (auto simp: field_split_simps assms less_imp_le)
[PROOF STATE]
proof (state)
this:
1 / real (Suc ?n * 2 + 1) * x ^ (Suc ?n * 2 + 1) \<le> 1 / real (?n * 2 + 1) * x ^ (?n * 2 + 1)

goal (2 subgoals):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x
 2. arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
from summable_Leibniz'(4)[of ?a, OF tendsto_zero nonneg le, of n]
    summable_Leibniz'(2)[of ?a, OF tendsto_zero nonneg le, of n]
    assms
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
(\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
0 \<le> x
x < 1
[PROOF STEP]
show "(\<Sum>k<2*n. (- 1)^ k * ?a k) \<le> arctan x" "arctan x \<le> (\<Sum>k<2 * n + 1. (- 1)^ k * ?a k)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> (\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
(\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
0 \<le> x
x < 1

goal (1 subgoal):
 1. (\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x &&& arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
by (auto simp: arctan_series)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \<le> arctan x
arctan x \<le> (\<Sum>k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_sum_upto_moebius_mu_over_n_less:
  assumes x: "x \<ge> 2"
  shows   "\<bar>M x\<bar> < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "x * sum_upto (\<lambda>n. moebius_mu n / n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / n)) x =
          sum_upto (\<lambda>n. moebius_mu n * (x / n - frac (x / n))) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * sum_upto (\<lambda>n. moebius_mu n / real n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * (x / real n - frac (x / real n))) x
[PROOF STEP]
by (subst mult.commute[of x])
       (simp add: sum_upto_def sum_distrib_right sum_subtractf ring_distribs)
[PROOF STATE]
proof (state)
this:
x * sum_upto (\<lambda>n. moebius_mu n / real n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * (x / real n - frac (x / real n))) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * sum_upto (\<lambda>n. moebius_mu n / real n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x = sum_upto (\<lambda>n. moebius_mu n * (x / real n - frac (x / real n))) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "(\<lambda>n. x / real n - frac (x / real n)) = (\<lambda>n. of_int (floor (x / real n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. x / real n - frac (x / real n)) = (\<lambda>n. real_of_int \<lfloor>x / real n\<rfloor>)
[PROOF STEP]
by (simp add: frac_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. x / real n - frac (x / real n)) = (\<lambda>n. real_of_int \<lfloor>x / real n\<rfloor>)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. x / real n - frac (x / real n)) = (\<lambda>n. real_of_int \<lfloor>x / real n\<rfloor>)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "sum_upto (\<lambda>n. moebius_mu n * real_of_int \<lfloor>x / real n\<rfloor>) x =
               real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. moebius_mu n * real_of_int \<lfloor>x / real n\<rfloor>) x = real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x)
[PROOF STEP]
by (simp add: sum_upto_def)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * real_of_int \<lfloor>x / real n\<rfloor>) x = real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. moebius_mu n * real_of_int \<lfloor>x / real n\<rfloor>) x = real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x) = 1
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x) = 1
[PROOF STEP]
by (subst sum_upto_moebius_times_floor_linear) auto
[PROOF STATE]
proof (state)
this:
real_of_int (sum_upto (\<lambda>n. moebius_mu n * \<lfloor>x / real n\<rfloor>) x) = 1

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * sum_upto (\<lambda>n. moebius_mu n / real n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x = 1
[PROOF STEP]
have eq: "x * M x = 1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / n)) x"
[PROOF STATE]
proof (prove)
using this:
x * sum_upto (\<lambda>n. moebius_mu n / real n) x - sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x = 1

goal (1 subgoal):
 1. x * M x = 1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x
[PROOF STEP]
by (simp add: M_def)
[PROOF STATE]
proof (state)
this:
x * M x = 1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "x * \<bar>M x\<bar> = \<bar>x * M x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * \<bar>M x\<bar> = \<bar>x * M x\<bar>
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. x * \<bar>M x\<bar> = \<bar>x * M x\<bar>
[PROOF STEP]
by (simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
x * \<bar>M x\<bar> = \<bar>x * M x\<bar>

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * \<bar>M x\<bar> = \<bar>x * M x\<bar>

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
note eq
[PROOF STATE]
proof (state)
this:
x * M x = 1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * M x = 1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<bar>1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / n)) x\<bar> \<le>
               1 + \<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / n)) x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> 1 + \<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<bar>1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> 1 + \<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar>

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>1 + sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> 1 + \<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar>

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / n)) x\<bar> \<le>
               sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / n)\<bar>) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>n\<in>{i. 0 < i \<and> real i \<le> x}. moebius_mu n * frac (x / real n)\<bar> \<le> (\<Sum>n\<in>{i. 0 < i \<and> real i \<le> x}. \<bar>moebius_mu n * frac (x / real n)\<bar>)
[PROOF STEP]
by (rule sum_abs)
[PROOF STATE]
proof (state)
this:
\<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>sum_upto (\<lambda>n. moebius_mu n * frac (x / real n)) x\<bar> \<le> sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<dots> \<le> sum_upto (\<lambda>n. frac (x / n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x \<le> sum_upto (\<lambda>xa. frac (x / real xa)) x
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{i. 0 < i \<and> real i \<le> x}. \<bar>moebius_mu n * frac (x / real n)\<bar>) \<le> (\<Sum>xa\<in>{i. 0 < i \<and> real i \<le> x}. frac (x / real xa))
[PROOF STEP]
by (intro sum_mono) (auto simp: moebius_mu_def abs_mult)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x \<le> sum_upto (\<lambda>xa. frac (x / real xa)) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<bar>moebius_mu n * frac (x / real n)\<bar>) x \<le> sum_upto (\<lambda>xa. frac (x / real xa)) x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<dots> = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. frac (x / n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>xa. frac (x / real xa)) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. frac (x / real n))
[PROOF STEP]
by (simp add: sum_upto_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>xa. frac (x / real xa)) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. frac (x / real n))

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>xa. frac (x / real xa)) x = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. frac (x / real n))

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "{0<..nat \<lfloor>x\<rfloor>} = insert 1 {1<..nat \<lfloor>x\<rfloor>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0<..nat \<lfloor>x\<rfloor>} = insert 1 {1<..nat \<lfloor>x\<rfloor>}
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. {0<..nat \<lfloor>x\<rfloor>} = insert 1 {1<..nat \<lfloor>x\<rfloor>}
[PROOF STEP]
by (auto simp: le_nat_iff le_floor_iff)
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = insert 1 {1<..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{0<..nat \<lfloor>x\<rfloor>} = insert 1 {1<..nat \<lfloor>x\<rfloor>}

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "(\<Sum>n\<in>\<dots>. frac (x / n)) = frac x + (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>insert 1 {1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) = frac x + (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n))
[PROOF STEP]
by (subst sum.insert) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>insert 1 {1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) = frac x + (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n))

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>insert 1 {1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) = frac x + (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n))

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / n)) < (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) < (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) < (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)
[PROOF STEP]
by (intro sum_strict_mono frac_lt_1) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) < (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. frac (x / real n)) < (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "\<dots> = nat \<lfloor>x\<rfloor> - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{1<..nat \<lfloor>x\<rfloor>}. 1) = real (nat \<lfloor>x\<rfloor> - 1)

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
have "1 + (frac x + real (nat \<lfloor>x\<rfloor> - 1)) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + (frac x + real (nat \<lfloor>x\<rfloor> - 1)) = x
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. 1 + (frac x + real (nat \<lfloor>x\<rfloor> - 1)) = x
[PROOF STEP]
by (subst of_nat_diff) (auto simp: le_nat_iff le_floor_iff frac_def)
[PROOF STATE]
proof (state)
this:
1 + (frac x + real (nat \<lfloor>x\<rfloor> - 1)) = x

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> 1 + x \<le> 1 + y; \<And>x y. x \<le> y \<Longrightarrow> 1 + x \<le> 1 + y; \<And>xa y. xa < y \<Longrightarrow> 1 + (frac x + xa) < 1 + (frac x + y)\<rbrakk> \<Longrightarrow> x * \<bar>M x\<bar> < x
[PROOF STEP]
have "x * \<bar>M x\<bar> < x * 1"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> 1 + x \<le> 1 + y; \<And>x y. x \<le> y \<Longrightarrow> 1 + x \<le> 1 + y; \<And>xa y. xa < y \<Longrightarrow> 1 + (frac x + xa) < 1 + (frac x + y)\<rbrakk> \<Longrightarrow> x * \<bar>M x\<bar> < x

goal (1 subgoal):
 1. x * \<bar>M x\<bar> < x * 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * \<bar>M x\<bar> < x * 1

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
2 \<le> x
x * \<bar>M x\<bar> < x * 1
[PROOF STEP]
show "\<bar>M x\<bar> < 1"
[PROOF STATE]
proof (prove)
using this:
2 \<le> x
x * \<bar>M x\<bar> < x * 1

goal (1 subgoal):
 1. \<bar>M x\<bar> < 1
[PROOF STEP]
by (subst (asm) mult_less_cancel_left_pos) auto
[PROOF STATE]
proof (state)
this:
\<bar>M x\<bar> < 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_fun_unfold_prod:
  fixes f g :: "'a :: monoid_add \<Rightarrow> 'b::semiring_0"
  assumes fin_f: "finite {a. f a \<noteq> 0}"
  assumes fin_g: "finite {b. g b \<noteq> 0}"
  shows "prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
let ?C = "{a. f a \<noteq> 0} \<times> {b. g b \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
from fin_f fin_g
[PROOF STATE]
proof (chain)
picking this:
finite {a. f a \<noteq> (0::'b)}
finite {b. g b \<noteq> (0::'b)}
[PROOF STEP]
have "finite ?C"
[PROOF STATE]
proof (prove)
using this:
finite {a. f a \<noteq> (0::'b)}
finite {b. g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})

goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})

goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
have "{a. \<exists>b. (f a * g b when k = a + b) \<noteq> 0} \<times>
    {b. \<exists>a. (f a * g b when k = a + b) \<noteq> 0} \<subseteq> {a. f a \<noteq> 0} \<times> {b. g b \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. \<exists>b. (f a * g b when k = a + b) \<noteq> (0::'b)} \<times> {b. \<exists>a. (f a * g b when k = a + b) \<noteq> (0::'b)} \<subseteq> {a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a. \<exists>b. (f a * g b when k = a + b) \<noteq> (0::'b)} \<times> {b. \<exists>a. (f a * g b when k = a + b) \<noteq> (0::'b)} \<subseteq> {a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
{a. \<exists>b. (f a * g b when k = a + b) \<noteq> (0::'b)} \<times> {b. \<exists>a. (f a * g b when k = a + b) \<noteq> (0::'b)} \<subseteq> {a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
{a. \<exists>b. (f a * g b when k = a + b) \<noteq> (0::'b)} \<times> {b. \<exists>a. (f a * g b when k = a + b) \<noteq> (0::'b)} \<subseteq> {a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
using fin_g
[PROOF STATE]
proof (prove)
using this:
finite ({a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)})
{a. \<exists>b. (f a * g b when k = a + b) \<noteq> (0::'b)} \<times> {b. \<exists>a. (f a * g b when k = a + b) \<noteq> (0::'b)} \<subseteq> {a. f a \<noteq> (0::'b)} \<times> {b. g b \<noteq> (0::'b)}
finite {b. g b \<noteq> (0::'b)}

goal (1 subgoal):
 1. prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)
[PROOF STEP]
by (auto simp add: prod_fun_def
      Sum_any.cartesian_product [of "{a. f a \<noteq> 0} \<times> {b. g b \<noteq> 0}"] Sum_any_right_distrib mult_when)
[PROOF STATE]
proof (state)
this:
prod_fun f g k = (\<Sum>(a, b). f a * g b when k = a + b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_dense_exists:
  "\<exists>D::'a set. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d \<in> D. d \<in> X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))
[PROOF STEP]
let ?f = "(\<lambda>B'. SOME x. x \<in> B')"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))
[PROOF STEP]
have "countable (?f ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable ((\<lambda>B'. SOME x. x \<in> B') ` B)
[PROOF STEP]
using countable_basis
[PROOF STATE]
proof (prove)
using this:
countable B

goal (1 subgoal):
 1. countable ((\<lambda>B'. SOME x. x \<in> B') ` B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
countable ((\<lambda>B'. SOME x. x \<in> B') ` B)

goal (1 subgoal):
 1. \<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))
[PROOF STEP]
with basis_dense[OF is_basis, of ?f]
[PROOF STATE]
proof (chain)
picking this:
(\<And>B'. B' \<noteq> {} \<Longrightarrow> (SOME x. x \<in> B') \<in> B') \<Longrightarrow> \<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B'\<in>B. (SOME x. x \<in> B') \<in> X)
countable ((\<lambda>B'. SOME x. x \<in> B') ` B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>B'. B' \<noteq> {} \<Longrightarrow> (SOME x. x \<in> B') \<in> B') \<Longrightarrow> \<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B'\<in>B. (SOME x. x \<in> B') \<in> X)
countable ((\<lambda>B'. SOME x. x \<in> B') ` B)

goal (1 subgoal):
 1. \<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))
[PROOF STEP]
by (intro exI[where x="?f ` B"]) (metis (mono_tags) all_not_in_conv imageI someI)
[PROOF STATE]
proof (state)
this:
\<exists>D. countable D \<and> (\<forall>X. p X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d\<in>D. d \<in> X))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma R_state_repetition_distribution :
  assumes "OFSM M"
  and     "Suc (card (nodes M) * m) \<le> length xs"
  and     "vs@xs \<in> L M"
shows "\<exists> q \<in> nodes M . card (R M q vs xs) > m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q\<in>nodes M. m < card (R M q vs xs)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))
[PROOF STEP]
have "\<forall> q \<in> nodes M . card (R M q vs xs) \<le> m"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs))

goal (1 subgoal):
 1. \<forall>q\<in>nodes M. card (R M q vs xs) \<le> m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m
[PROOF STEP]
have "sum (\<lambda> q . card (R M q vs xs)) (nodes M) \<le> sum (\<lambda> q . m) (nodes M)"
[PROOF STATE]
proof (prove)
using this:
\<forall>q\<in>nodes M. card (R M q vs xs) \<le> m

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
[PROOF STEP]
by (meson sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
have "sum (\<lambda> q . m) (nodes M) \<le> card (nodes M) * m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
Suc (|M| * m) \<le> length xs

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. m) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
(\<Sum>q\<in>nodes M. m) \<le> |M| * m
[PROOF STEP]
have "sum (\<lambda> q . card (R M q vs xs)) (nodes M) \<le> card (nodes M) * m"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> (\<Sum>q\<in>nodes M. m)
(\<Sum>q\<in>nodes M. m) \<le> |M| * m

goal (1 subgoal):
 1. (\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
have "Suc (card (nodes M)*m) \<le> sum (\<lambda> q . card (R M q vs xs)) (nodes M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
using R_union_card_is_suffix_length[OF assms(1), of vs xs] assms(3,2)
[PROOF STATE]
proof (prove)
using this:
vs @ xs \<in> L M \<Longrightarrow> (\<Sum>q\<in>nodes M. card (R M q vs xs)) = length xs
vs @ xs \<in> L M
Suc (|M| * m) \<le> length xs

goal (1 subgoal):
 1. Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))

goal (1 subgoal):
 1. \<not> (\<exists>q\<in>nodes M. m < card (R M q vs xs)) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>q\<in>nodes M. card (R M q vs xs)) \<le> |M| * m
Suc (|M| * m) \<le> (\<Sum>q\<in>nodes M. card (R M q vs xs))

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

goal:
No subgoals!
[PROOF STEP]
qed