[STATEMENT]
lemma imp_ab_rational:
  assumes "\<exists> (B::int)>0. \<exists> c::nat\<Rightarrow> int.
              (\<forall>\<^sub>F n in sequentially. B*b n = c n * a n - c(n+1) \<and> \<bar>c(n+1)\<bar><a n/2)"
  shows "(\<Sum>n. (b n / (\<Prod>i \<le> n. a i))) \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
obtain B::int and c::"nat\<Rightarrow>int" and N::nat where "B>0" and
    large_n:"\<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < a n / 2
                      \<and> a n\<ge>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B N c. \<lbrakk>0 < B; \<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>B N c. \<lbrakk>0 < B; \<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain B c where "B>0" and event1:"\<forall>\<^sub>F n in sequentially. B * b n = c n * a n - c (n + 1)
              \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B c. \<lbrakk>0 < B; \<forall>\<^sub>F n in sequentially. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>B>0. \<exists>c. \<forall>\<^sub>F n in sequentially. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2

goal (1 subgoal):
 1. (\<And>B c. \<lbrakk>0 < B; \<forall>\<^sub>F n in sequentially. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < B
\<forall>\<^sub>F n in sequentially. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2

goal (1 subgoal):
 1. (\<And>B N c. \<lbrakk>0 < B; \<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from eventually_conj[OF event1 a_large,unfolded eventually_at_top_linorder]
[PROOF STATE]
proof (chain)
picking this:
\<exists>N. \<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 1 < a n
[PROOF STEP]
obtain N where "\<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1)
                        \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n"
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 1 < a n

goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n

goal (1 subgoal):
 1. (\<And>B N c. \<lbrakk>0 < B; \<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that[of B N c] \<open>B>0\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. (B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2) \<and> 2 \<le> a n
\<lbrakk>0 < B; \<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n\<rbrakk> \<Longrightarrow> thesis
0 < B

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < B
\<forall>n\<ge>N. B * b n = c n * a n - c (n + 1) \<and> real_of_int \<bar>c (n + 1)\<bar> < real_of_int (a n) / 2 \<and> 2 \<le> a n

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
define f where "f=(\<lambda>n. real_of_int (b n) / real_of_int (prod a {..n}))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>n. real_of_int (b n) / real_of_int (prod a {..n}))

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
define S where "S = (\<Sum>n. f n)"
[PROOF STATE]
proof (state)
this:
S = (\<Sum>n. f n)

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
have "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. real_of_int (b n) / real_of_int (prod a {..n}))
[PROOF STEP]
by (rule aux_series_summable)
[PROOF STATE]
proof (state)
this:
summable f

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
define C where "C=B*prod a {..<N} * (\<Sum>n<N. f n)"
[PROOF STATE]
proof (state)
this:
C = real_of_int (B * prod a {..<N}) * sum f {..<N}

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
have "B*prod a {..<N} * S = C + real_of_int (c N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
define h1 where "h1 \<equiv> (\<lambda>n. (c (n+N) * a (n+N)) / prod a {N..n+N})"
[PROOF STATE]
proof (state)
this:
h1 \<equiv> \<lambda>n. real_of_int (c (n + N) * a (n + N)) / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
define h2 where "h2 \<equiv> (\<lambda>n. c (n+N+1) / prod a {N..n+N})"
[PROOF STATE]
proof (state)
this:
h2 \<equiv> \<lambda>n. real_of_int (c (n + N + 1)) / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have f_h12: "B * prod a {..<N}*f (n+N) = h1 n - h2 n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
define g1 where "g1 \<equiv> (\<lambda>n. B * b (n+N))"
[PROOF STATE]
proof (state)
this:
g1 \<equiv> \<lambda>n. B * b (n + N)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
define g2 where "g2 \<equiv> (\<lambda>n. prod a {..<N} / prod a {..n + N})"
[PROOF STATE]
proof (state)
this:
g2 \<equiv> \<lambda>n. real_of_int (prod a {..<N}) / real_of_int (prod a {..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
have "B * prod a {..<N}*f (n+N) = (g1 n * g2 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (g1 n) * g2 n
[PROOF STEP]
unfolding f_def g1_def g2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * (real_of_int (b (n + N)) / real_of_int (prod a {..n + N})) = real_of_int (B * b (n + N)) * (real_of_int (prod a {..<N}) / real_of_int (prod a {..n + N}))
[PROOF STEP]
by (auto simp:algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (g1 n) * g2 n

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (g1 n) * g2 n

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
have "g1 n = c (n+N) * a (n+N) - c (n+N+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g1 n = c (n + N) * a (n + N) - c (n + N + 1)
[PROOF STEP]
using large_n[rule_format,of "n+N"]
[PROOF STATE]
proof (prove)
using this:
N \<le> n + N \<Longrightarrow> B * b (n + N) = c (n + N) * a (n + N) - c (n + N + 1) \<and> real_of_int \<bar>c (n + N + 1)\<bar> < real_of_int (a (n + N)) / 2 \<and> 2 \<le> a (n + N)

goal (1 subgoal):
 1. g1 n = c (n + N) * a (n + N) - c (n + N + 1)
[PROOF STEP]
unfolding g1_def
[PROOF STATE]
proof (prove)
using this:
N \<le> n + N \<Longrightarrow> B * b (n + N) = c (n + N) * a (n + N) - c (n + N + 1) \<and> real_of_int \<bar>c (n + N + 1)\<bar> < real_of_int (a (n + N)) / 2 \<and> 2 \<le> a (n + N)

goal (1 subgoal):
 1. B * b (n + N) = c (n + N) * a (n + N) - c (n + N + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g1 n = c (n + N) * a (n + N) - c (n + N + 1)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g1 n = c (n + N) * a (n + N) - c (n + N + 1)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
have "g2 n = (1/prod a {N..n+N})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
have "prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}
[PROOF STEP]
apply (rule prod.union_disjoint[of "{..<N}" "{N..n+N}" a])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<N}
 2. finite {N..n + N}
 3. {..<N} \<inter> {N..n + N} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}

goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}

goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
have "prod a ({..<N} \<union> {N..n + N}) = prod a {..n+N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod a ({..<N} \<union> {N..n + N}) = prod a {..n + N}
[PROOF STEP]
by (simp add: ivl_disj_un_one(4))
[PROOF STATE]
proof (state)
this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..n + N}

goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}
prod a ({..<N} \<union> {N..n + N}) = prod a {..n + N}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}
prod a ({..<N} \<union> {N..n + N}) = prod a {..n + N}

goal (1 subgoal):
 1. g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
unfolding g2_def
[PROOF STATE]
proof (prove)
using this:
prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}
prod a ({..<N} \<union> {N..n + N}) = prod a {..n + N}

goal (1 subgoal):
 1. real_of_int (prod a {..<N}) / real_of_int (prod a {..n + N}) = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prod a {..n + N} = prod a {..<N} * prod a {N..n + N}; prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}\<rbrakk> \<Longrightarrow> (\<exists>aa\<in>{..<N}. a aa = 0) \<longrightarrow> (\<exists>aa\<in>{N..n + N}. a aa = 0)
[PROOF STEP]
using a_pos
[PROOF STATE]
proof (prove)
using this:
\<forall>n. 0 < a n

goal (1 subgoal):
 1. \<lbrakk>prod a {..n + N} = prod a {..<N} * prod a {N..n + N}; prod a ({..<N} \<union> {N..n + N}) = prod a {..<N} * prod a {N..n + N}\<rbrakk> \<Longrightarrow> (\<exists>aa\<in>{..<N}. a aa = 0) \<longrightarrow> (\<exists>aa\<in>{N..n + N}. a aa = 0)
[PROOF STEP]
by (metis less_irrefl)
[PROOF STATE]
proof (state)
this:
g2 n = 1 / real_of_int (prod a {N..n + N})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g2 n = 1 / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (g1 n) * g2 n
g1 n = c (n + N) * a (n + N) - c (n + N + 1)
g2 n = 1 / real_of_int (prod a {N..n + N})
[PROOF STEP]
have "B*prod a {..<N}*f (n+N) = (c (n+N) * a (n+N) - c (n+N+1)) / prod a {N..n+N}"
[PROOF STATE]
proof (prove)
using this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (g1 n) * g2 n
g1 n = c (n + N) * a (n + N) - c (n + N + 1)
g2 n = 1 / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (n + N) = real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
have "... = h1 n - h2 n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N}) = h1 n - h2 n
[PROOF STEP]
unfolding h1_def h2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N}) = real_of_int (c (n + N) * a (n + N)) / real_of_int (prod a {N..n + N}) - real_of_int (c (n + N + 1)) / real_of_int (prod a {N..n + N})
[PROOF STEP]
by (auto simp:algebra_simps diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
real_of_int (c (n + N) * a (n + N) - c (n + N + 1)) / real_of_int (prod a {N..n + N}) = h1 n - h2 n

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (n + N) = h1 n - h2 n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * f (?n + N) = h1 ?n - h2 ?n

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "B*prod a {..<N} * S = B*prod a {..<N} * ((\<Sum>n<N. f n) + (\<Sum>n. f (n+N)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N)))
[PROOF STEP]
using suminf_split_initial_segment[OF \<open>summable f\<close>,of N]
[PROOF STATE]
proof (prove)
using this:
suminf f = (\<Sum>n. f (n + N)) + sum f {..<N}

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N)))
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
suminf f = (\<Sum>n. f (n + N)) + sum f {..<N}

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * suminf f = real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N)))
[PROOF STEP]
by (auto simp:algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * S = real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N)))

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * S = real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N)))

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "... = C + B*prod a {..<N}*(\<Sum>n. f (n+N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N))) = C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N))
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N))) = real_of_int (B * prod a {..<N}) * sum f {..<N} + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N))
[PROOF STEP]
by (auto simp:algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N))) = C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N))

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * (sum f {..<N} + (\<Sum>n. f (n + N))) = C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N))

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "... = C + (\<Sum>n. h1 n - h2 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N)) = C + (\<Sum>n. h1 n - h2 n)
[PROOF STEP]
apply (subst suminf_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. summable (\<lambda>n. f (n + N))
 2. C + (\<Sum>n. real_of_int (B * prod a {..<N}) * f (n + N)) = C + (\<Sum>n. h1 n - h2 n)
[PROOF STEP]
using \<open>summable f\<close> f_h12
[PROOF STATE]
proof (prove)
using this:
summable f
real_of_int (B * prod a {..<N}) * f (?n + N) = h1 ?n - h2 ?n

goal (2 subgoals):
 1. summable (\<lambda>n. f (n + N))
 2. C + (\<Sum>n. real_of_int (B * prod a {..<N}) * f (n + N)) = C + (\<Sum>n. h1 n - h2 n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N)) = C + (\<Sum>n. h1 n - h2 n)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C + real_of_int (B * prod a {..<N}) * (\<Sum>n. f (n + N)) = C + (\<Sum>n. h1 n - h2 n)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "... = C + h1 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
have "(\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)
[PROOF STEP]
proof (rule summable_LIMSEQ')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable (\<lambda>i. h1 i - h2 i)
[PROOF STEP]
have "(\<lambda>i. h1 i - h2 i) = (\<lambda>i.  real_of_int (B * prod a {..<N}) * f (i + N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))
[PROOF STEP]
using f_h12
[PROOF STATE]
proof (prove)
using this:
real_of_int (B * prod a {..<N}) * f (?n + N) = h1 ?n - h2 ?n

goal (1 subgoal):
 1. (\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))

goal (1 subgoal):
 1. summable (\<lambda>i. h1 i - h2 i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))
[PROOF STEP]
show "summable (\<lambda>i. h1 i - h2 i)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))

goal (1 subgoal):
 1. summable (\<lambda>i. h1 i - h2 i)
[PROOF STEP]
using \<open>summable f\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. h1 i - h2 i) = (\<lambda>i. real_of_int (B * prod a {..<N}) * f (i + N))
summable f

goal (1 subgoal):
 1. summable (\<lambda>i. h1 i - h2 i)
[PROOF STEP]
by (simp add: summable_mult)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>i. h1 i - h2 i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
have "(\<Sum>i\<le>n. h1 i - h2 i)  = h1 0 - h2 n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>i\<le>0. h1 i - h2 i) = h1 0 - h2 0
 2. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>i\<le>0. h1 i - h2 i) = h1 0 - h2 0
 2. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>0. h1 i - h2 i) = h1 0 - h2 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>0. h1 i - h2 i) = h1 0 - h2 0

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
have "(\<Sum>i\<le>Suc n. h1 i - h2 i) = (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n+1) - h2 (n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>Suc n. h1 i - h2 i) = (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc n. h1 i - h2 i) = (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc n. h1 i - h2 i) = (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
have "... =  h1 0 - h2 n + h1 (n+1) - h2 (n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 n + h1 (n + 1) - h2 (n + 1)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n

goal (1 subgoal):
 1. (\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 n + h1 (n + 1) - h2 (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 n + h1 (n + 1) - h2 (n + 1)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. h1 i - h2 i) + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 n + h1 (n + 1) - h2 (n + 1)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
have "... = h1 0 - h2 (n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)
[PROOF STEP]
have "h2 n = h1 (n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h2 n = h1 (n + 1)
[PROOF STEP]
unfolding h2_def h1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (c (n + N + 1)) / real_of_int (prod a {N..n + N}) = real_of_int (c (n + 1 + N) * a (n + 1 + N)) / real_of_int (prod a {N..n + 1 + N})
[PROOF STEP]
apply (auto simp:prod.nat_ivl_Suc')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a (Suc (n + N)) = 0; \<forall>aa\<in>{N..n + N}. a aa \<noteq> 0\<rbrakk> \<Longrightarrow> c (Suc (n + N)) = 0
[PROOF STEP]
using a_pos
[PROOF STATE]
proof (prove)
using this:
\<forall>n. 0 < a n

goal (1 subgoal):
 1. \<lbrakk>a (Suc (n + N)) = 0; \<forall>aa\<in>{N..n + N}. a aa \<noteq> 0\<rbrakk> \<Longrightarrow> c (Suc (n + N)) = 0
[PROOF STEP]
by (metis less_numeral_extra(3))
[PROOF STATE]
proof (state)
this:
h2 n = h1 (n + 1)

goal (1 subgoal):
 1. h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
h2 n = h1 (n + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h2 n = h1 (n + 1)

goal (1 subgoal):
 1. h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
h1 0 - h2 n + h1 (n + 1) - h2 (n + 1) = h1 0 - h2 (n + 1)

goal (1 subgoal):
 1. \<And>n. (\<Sum>i\<le>n. h1 i - h2 i) = h1 0 - h2 n \<Longrightarrow> (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (n + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (n + 1)

goal (1 subgoal):
 1. (\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc n. h1 i - h2 i) = h1 0 - h2 (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>?n. h1 i - h2 i) = h1 0 - h2 ?n

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)
(\<Sum>i\<le>?n. h1 i - h2 i) = h1 0 - h2 ?n
[PROOF STEP]
have "(\<lambda>n. h1 0 - h2 n) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i\<le>n. h1 i - h2 i) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)
(\<Sum>i\<le>?n. h1 i - h2 i) = h1 0 - h2 ?n

goal (1 subgoal):
 1. (\<lambda>n. h1 0 - h2 n) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. h1 0 - h2 n) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. h1 0 - h2 n) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)
[PROOF STEP]
have "h2 \<longlonglongrightarrow> (h1 0 -  (\<Sum>i. h1 i - h2 i))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. h1 0 - h2 n) \<longlonglongrightarrow> (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)
[PROOF STEP]
apply (elim metric_tendsto_imp_tendsto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. dist (h2 x) (h1 0 - (\<Sum>i. h1 i - h2 i)) \<le> dist (h1 0 - h2 x) (\<Sum>i. h1 i - h2 i)
[PROOF STEP]
by (auto intro!:eventuallyI simp add:dist_real_def)
[PROOF STATE]
proof (state)
this:
h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
have "h2 \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> 0
[PROOF STEP]
have h2_n:"\<bar>h2 n\<bar> < (1 / 2)^(n+1)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
have "\<bar>h2 n\<bar> = \<bar>c (n + N + 1)\<bar> / prod a {N..n + N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>h2 n\<bar> = real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N})
[PROOF STEP]
unfolding h2_def abs_divide
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>real_of_int (c (n + N + 1))\<bar> / \<bar>real_of_int (prod a {N..n + N})\<bar> = real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N})
[PROOF STEP]
using a_pos
[PROOF STATE]
proof (prove)
using this:
\<forall>n. 0 < a n

goal (1 subgoal):
 1. \<bar>real_of_int (c (n + N + 1))\<bar> / \<bar>real_of_int (prod a {N..n + N})\<bar> = real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N})
[PROOF STEP]
by (simp add: abs_of_pos prod_pos)
[PROOF STATE]
proof (state)
this:
\<bar>h2 n\<bar> = real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>h2 n\<bar> = real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
have "... < (a (N+n) / 2) / prod a {N..n + N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N}) < real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N})
[PROOF STEP]
unfolding h2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N}) < real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N})
[PROOF STEP]
apply (rule divide_strict_right_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. real_of_int \<bar>c (n + N + 1)\<bar> < real_of_int (a (N + n)) / 2
 2. 0 < real_of_int (prod a {N..n + N})
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<bar>c (n + N + 1)\<bar> < real_of_int (a (N + n)) / 2
[PROOF STEP]
using large_n[rule_format,of "N+n"]
[PROOF STATE]
proof (prove)
using this:
N \<le> N + n \<Longrightarrow> B * b (N + n) = c (N + n) * a (N + n) - c (N + n + 1) \<and> real_of_int \<bar>c (N + n + 1)\<bar> < real_of_int (a (N + n)) / 2 \<and> 2 \<le> a (N + n)

goal (1 subgoal):
 1. real_of_int \<bar>c (n + N + 1)\<bar> < real_of_int (a (N + n)) / 2
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real_of_int (prod a {N..n + N})
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real_of_int (prod a {N..n + N})
[PROOF STEP]
using a_pos
[PROOF STATE]
proof (prove)
using this:
\<forall>n. 0 < a n

goal (1 subgoal):
 1. 0 < real_of_int (prod a {N..n + N})
[PROOF STEP]
by (simp add: prod_pos)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N}) < real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<bar>c (n + N + 1)\<bar> / real_of_int (prod a {N..n + N}) < real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
have "... = 1 / (2*prod a {N..<n + N})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N}) = 1 / real_of_int (2 * prod a {N..<n + N})
[PROOF STEP]
apply (subst ivl_disj_un(6)[of N "n+N",symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. N \<le> n + N
 2. real_of_int (a (N + n)) / 2 / real_of_int (prod a ({N..<n + N} \<union> {n + N})) = 1 / real_of_int (2 * prod a {N..<n + N})
[PROOF STEP]
using a_pos[rule_format,of "N+n"]
[PROOF STATE]
proof (prove)
using this:
0 < a (N + n)

goal (2 subgoals):
 1. N \<le> n + N
 2. real_of_int (a (N + n)) / 2 / real_of_int (prod a ({N..<n + N} \<union> {n + N})) = 1 / real_of_int (2 * prod a {N..<n + N})
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N}) = 1 / real_of_int (2 * prod a {N..<n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (a (N + n)) / 2 / real_of_int (prod a {N..n + N}) = 1 / real_of_int (2 * prod a {N..<n + N})

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
have "... \<le> (1/2)^(n+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 / real_of_int (2 * prod a {N..<0 + N}) \<le> (1 / 2) ^ (0 + 1)
 2. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 1 / real_of_int (2 * prod a {N..<0 + N}) \<le> (1 / 2) ^ (0 + 1)
 2. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<0 + N}) \<le> (1 / 2) ^ (0 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<0 + N}) \<le> (1 / 2) ^ (0 + 1)

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
define P where "P=1 / real_of_int (2 * prod a {N..<n + N})"
[PROOF STATE]
proof (state)
this:
P = 1 / real_of_int (2 * prod a {N..<n + N})

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
have "1 / real_of_int (2 * prod a {N..<Suc n + N}) = P / a (n+N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<Suc n + N}) = P / real_of_int (a (n + N))
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<Suc n + N}) = 1 / real_of_int (2 * prod a {N..<n + N}) / real_of_int (a (n + N))
[PROOF STEP]
by (auto simp add: prod.atLeastLessThan_Suc)
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<Suc n + N}) = P / real_of_int (a (n + N))

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<Suc n + N}) = P / real_of_int (a (n + N))

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
have "... \<le>  ( (1 / 2) ^ (n + 1) ) / a (n+N) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / real_of_int (a (n + N))
[PROOF STEP]
apply (rule divide_right_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. P \<le> (1 / 2) ^ (n + 1)
 2. 0 \<le> real_of_int (a (n + N))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<le> (1 / 2) ^ (n + 1)
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)

goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_int (a (n + N))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_int (a (n + N))
[PROOF STEP]
by (simp add: a_pos less_imp_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
P / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / real_of_int (a (n + N))

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / real_of_int (a (n + N))

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
have "... \<le> ( (1 / 2) ^ (n + 1) ) / 2 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) ^ (n + 1) / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / 2
[PROOF STEP]
apply (rule divide_left_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 2 \<le> real_of_int (a (n + N))
 2. 0 \<le> (1 / 2) ^ (n + 1)
 3. 0 < real_of_int (a (n + N)) * 2
[PROOF STEP]
using large_n[rule_format,of "n+N",simplified]
[PROOF STATE]
proof (prove)
using this:
B * b (n + N) = c (n + N) * a (n + N) - c (Suc (n + N)) \<and> \<bar>real_of_int (c (Suc (n + N)))\<bar> * 2 < real_of_int (a (n + N)) \<and> 2 \<le> a (n + N)

goal (3 subgoals):
 1. 2 \<le> real_of_int (a (n + N))
 2. 0 \<le> (1 / 2) ^ (n + 1)
 3. 0 < real_of_int (a (n + N)) * 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 / 2) ^ (n + 1) / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / 2

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 / 2) ^ (n + 1) / real_of_int (a (n + N)) \<le> (1 / 2) ^ (n + 1) / 2

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
have "... = (1 / 2) ^ (n + 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) ^ (n + 1) / 2 = (1 / 2) ^ (n + 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 / 2) ^ (n + 1) / 2 = (1 / 2) ^ (n + 2)

goal (1 subgoal):
 1. \<And>n. 1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1) \<Longrightarrow> 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (n + 2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (n + 2)

goal (1 subgoal):
 1. 1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<Suc n + N}) \<le> (1 / 2) ^ (Suc n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 / real_of_int (2 * prod a {N..<n + N}) \<le> (1 / 2) ^ (n + 1)

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)

goal (1 subgoal):
 1. \<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>h2 n\<bar> < (1 / 2) ^ (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>h2 ?n\<bar> < (1 / 2) ^ (?n + 1)

goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. (1 / 2)^(n+1)) \<longlonglongrightarrow> (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ (n + 1)) \<longlonglongrightarrow> 0
[PROOF STEP]
using tendsto_mult_right_zero[OF LIMSEQ_abs_realpow_zero2[of "1/2",simplified],of "1/2"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. 1 / 2 * (1 / 2) ^ x) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ (n + 1)) \<longlonglongrightarrow> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (1 / 2) ^ (n + 1)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (1 / 2) ^ (n + 1)) \<longlonglongrightarrow> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (1 / 2) ^ (n + 1)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. h2 \<longlonglongrightarrow> 0
[PROOF STEP]
apply (elim Lim_null_comparison[rotated])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. norm (h2 x) \<le> (1 / 2) ^ (x + 1)
[PROOF STEP]
using h2_n less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
\<bar>h2 ?n\<bar> < (1 / 2) ^ (?n + 1)
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. norm (h2 x) \<le> (1 / 2) ^ (x + 1)
[PROOF STEP]
by (auto intro!:eventuallyI)
[PROOF STATE]
proof (state)
this:
h2 \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
h2 \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)
h2 \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<Sum>i. h1 i - h2 i) = h1 0"
[PROOF STATE]
proof (prove)
using this:
h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)
h2 \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<Sum>i. h1 i - h2 i) = h1 0
[PROOF STEP]
using LIMSEQ_unique
[PROOF STATE]
proof (prove)
using this:
h2 \<longlonglongrightarrow> h1 0 - (\<Sum>i. h1 i - h2 i)
h2 \<longlonglongrightarrow> 0
\<lbrakk>?X \<longlonglongrightarrow> ?a; ?X \<longlonglongrightarrow> ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. (\<Sum>i. h1 i - h2 i) = h1 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>i. h1 i - h2 i) = h1 0

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i. h1 i - h2 i) = h1 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i. h1 i - h2 i) = h1 0

goal (1 subgoal):
 1. C + (\<Sum>n. h1 n - h2 n) = C + h1 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
C + (\<Sum>n. h1 n - h2 n) = C + h1 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
C + (\<Sum>n. h1 n - h2 n) = C + h1 0

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
C + (\<Sum>n. h1 n - h2 n) = C + h1 0

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "... = C + c N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C + h1 0 = C + real_of_int (c N)
[PROOF STEP]
unfolding h1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C + real_of_int (c (0 + N) * a (0 + N)) / real_of_int (prod a {N..0 + N}) = C + real_of_int (c N)
[PROOF STEP]
using a_pos
[PROOF STATE]
proof (prove)
using this:
\<forall>n. 0 < a n

goal (1 subgoal):
 1. C + real_of_int (c (0 + N) * a (0 + N)) / real_of_int (prod a {N..0 + N}) = C + real_of_int (c N)
[PROOF STEP]
by auto (metis less_irrefl)
[PROOF STATE]
proof (state)
this:
C + h1 0 = C + real_of_int (c N)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)

goal (1 subgoal):
 1. real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)
[PROOF STEP]
have "S = (C + real_of_int (c N)) / (B*prod a {..<N})"
[PROOF STATE]
proof (prove)
using this:
real_of_int (B * prod a {..<N}) * S = C + real_of_int (c N)

goal (1 subgoal):
 1. S = (C + real_of_int (c N)) / real_of_int (B * prod a {..<N})
[PROOF STEP]
by (metis \<open>0 < B\<close> a_pos less_irrefl mult.commute mult_pos_pos
        nonzero_mult_div_cancel_right of_int_eq_0_iff prod_pos)
[PROOF STATE]
proof (state)
this:
S = (C + real_of_int (c N)) / real_of_int (B * prod a {..<N})

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S = (C + real_of_int (c N)) / real_of_int (B * prod a {..<N})

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
have "... \<in> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C + real_of_int (c N)) / real_of_int (B * prod a {..<N}) \<in> \<rat>
[PROOF STEP]
unfolding C_def f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int (B * prod a {..<N}) * (\<Sum>n<N. real_of_int (b n) / real_of_int (prod a {..n})) + real_of_int (c N)) / real_of_int (B * prod a {..<N}) \<in> \<rat>
[PROOF STEP]
by (intro Rats_divide Rats_add Rats_mult Rats_of_int Rats_sum)
[PROOF STATE]
proof (state)
this:
(C + real_of_int (c N)) / real_of_int (B * prod a {..<N}) \<in> \<rat>

goal (1 subgoal):
 1. (\<Sum>n. real_of_int (b n) / real_of_int (prod a {..n})) \<in> \<rat>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S = (C + real_of_int (c N)) / real_of_int (B * prod a {..<N})
(C + real_of_int (c N)) / real_of_int (B * prod a {..<N}) \<in> \<rat>
[PROOF STEP]
show "S \<in> \<rat>"
[PROOF STATE]
proof (prove)
using this:
S = (C + real_of_int (c N)) / real_of_int (B * prod a {..<N})
(C + real_of_int (c N)) / real_of_int (B * prod a {..<N}) \<in> \<rat>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reduced_gso_E: "weakly_reduced \<alpha> k \<Longrightarrow> k \<le> m \<Longrightarrow> Suc i < k \<Longrightarrow>
  sq_norm (gso i) \<le> \<alpha> * sq_norm (gso (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>weakly_reduced \<alpha> k; k \<le> length fs; Suc i < k\<rbrakk> \<Longrightarrow> \<parallel>gso i\<parallel>\<^sup>2 \<le> \<alpha> * \<parallel>gso (Suc i)\<parallel>\<^sup>2
[PROOF STEP]
unfolding weakly_reduced_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. Suc i < k \<longrightarrow> \<parallel>gso i\<parallel>\<^sup>2 \<le> \<alpha> * \<parallel>gso (Suc i)\<parallel>\<^sup>2; k \<le> length fs; Suc i < k\<rbrakk> \<Longrightarrow> \<parallel>gso i\<parallel>\<^sup>2 \<le> \<alpha> * \<parallel>gso (Suc i)\<parallel>\<^sup>2
[PROOF STEP]
by auto


[STATEMENT]
lemma coplanar_subset: "\<lbrakk>coplanar t; S \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>coplanar t; S \<subseteq> t\<rbrakk> \<Longrightarrow> coplanar S
[PROOF STEP]
by (meson coplanar_def order_trans)


[STATEMENT]
lemma MatchOr: "matches \<gamma> (MatchOr m1 m2) a p \<longleftrightarrow> matches \<gamma> m1 a p \<or> matches \<gamma> m2 a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matches \<gamma> (MatchOr m1 m2) a p = (matches \<gamma> m1 a p \<or> matches \<gamma> m2 a p)
[PROOF STEP]
by(simp add: MatchOr_def matches_DeMorgan matches_not_idem)


[STATEMENT]
lemma winding_number_loops_linear_eq:
  "\<lbrakk>path g; path h; pathfinish g = pathstart g; pathfinish h = pathstart h;
    \<And>t. t \<in> {0..1} \<Longrightarrow> z \<notin> closed_segment (g t) (h t)\<rbrakk>
        \<Longrightarrow> winding_number h z = winding_number g z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>path g; path h; pathfinish g = pathstart g; pathfinish h = pathstart h; \<And>t. t \<in> {0..1} \<Longrightarrow> z \<notin> closed_segment (g t) (h t)\<rbrakk> \<Longrightarrow> winding_number h z = winding_number g z
[PROOF STEP]
by (blast intro: sym homotopic_loops_linear winding_number_homotopic_loops)


[STATEMENT]
lemma cong_scalar2_nat: "a mod m = b mod m \<Longrightarrow> (k*a) mod m = (k*b) mod m"
  for a b k :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> k * a mod m = k * b mod m
[PROOF STEP]
by (rule mod_mult_cong) simp_all


[STATEMENT]
lemma set_plus_rearrange3: "(a +o B) + C = a +o (B + C)"
  for a :: "'a::semigroup_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a +o B + C = a +o (B + C)
[PROOF STEP]
by (auto simp add: elt_set_plus_def set_plus_def; metis add.assoc)


[STATEMENT]
lemma product_trace_smap:
      assumes "length ps = length AA" "k < length AA"
      shows "smap (\<lambda> ps. ps ! k) (b.trace (product AA) w ps) = a.trace (AA ! k) w (ps ! k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smap (\<lambda>ps. ps ! k) (b.trace (product AA) w ps) = a.trace (AA ! k) w (ps ! k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length ps = length AA
k < length AA

goal (1 subgoal):
 1. smap (\<lambda>ps. ps ! k) (b.trace (product AA) w ps) = a.trace (AA ! k) w (ps ! k)
[PROOF STEP]
by (coinduction arbitrary: w ps) (force)


[STATEMENT]
theorem supt_subset_RPO_S: "{\<rhd>} \<subseteq> RPO_S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<rhd>} \<subseteq> RPO_S
[PROOF STEP]
using supt_subset_WPO_S
[PROOF STATE]
proof (prove)
using this:
(\<And>f k. set (\<sigma> (f, k)) = {0..<k}) \<Longrightarrow> {\<rhd>} \<subseteq> WPO_S

goal (1 subgoal):
 1. {\<rhd>} \<subseteq> RPO_S
[PROOF STEP]
unfolding rpo_eq_wpo
[PROOF STATE]
proof (prove)
using this:
(\<And>f k. set (\<sigma> (f, k)) = {0..<k}) \<Longrightarrow> {\<rhd>} \<subseteq> WPO_S

goal (1 subgoal):
 1. {\<rhd>} \<subseteq> WPO_S
[PROOF STEP]
by auto


[STATEMENT]
theorem wls_substEnv_vsubstEnv_compose2:
assumes  "wlsEnv rho" and "wls (asSort zs) Z"
and "ys \<noteq> zs \<or> y \<noteq> z" and fresh: "fresh ys y Z"
shows "((rho &[y1 // y]_ys) &[Z / z]_zs) = ((rho &[Z / z]_zs) &[((Var ys y1) #[Z / z]_zs) / y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[y1 // y]_ys &[Z / z]_zs = rho &[Z / z]_zs &[Var ys y1 #[Z / z]_zs / y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
wls (asSort zs) Z
ys \<noteq> zs \<or> y \<noteq> z
fresh ys y Z

goal (1 subgoal):
 1. rho &[y1 // y]_ys &[Z / z]_zs = rho &[Z / z]_zs &[Var ys y1 #[Z / z]_zs / y]_ys
[PROOF STEP]
by(simp add: substEnv_vsubstEnv_compose2)


[STATEMENT]
lemma pick_injective_goodAbs[simp]:
"\<lbrakk>goodAbs A; goodAbs B\<rbrakk> \<Longrightarrow> pick A = pick B \<longleftrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>goodAbs A; goodAbs B\<rbrakk> \<Longrightarrow> (pick A = pick B) = (A = B)
[PROOF STEP]
using pick_inj_on_goodAbs
[PROOF STATE]
proof (prove)
using this:
inj_on pick (Collect goodAbs)

goal (1 subgoal):
 1. \<lbrakk>goodAbs A; goodAbs B\<rbrakk> \<Longrightarrow> (pick A = pick B) = (A = B)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>Collect goodAbs. \<forall>y\<in>Collect goodAbs. pick x = pick y \<longrightarrow> x = y

goal (1 subgoal):
 1. \<lbrakk>goodAbs A; goodAbs B\<rbrakk> \<Longrightarrow> (pick A = pick B) = (A = B)
[PROOF STEP]
by auto


[STATEMENT]
lemma set_update_distinct: "\<lbrakk> distinct xs;  n < length xs \<rbrakk> \<Longrightarrow>
  set(xs[n := x]) = insert x (set xs - {xs!n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; n < length xs\<rbrakk> \<Longrightarrow> set (xs[n := x]) = insert x (set xs - {xs ! n})
[PROOF STEP]
by(auto simp: set_eq_iff in_set_conv_nth nth_list_update nth_eq_iff_index_eq)


[STATEMENT]
lemma imod_0: "0 mod (a::enat) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 mod a = 0
[PROOF STEP]
unfolding mod_enat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case 0 of enat x \<Rightarrow> case a of enat y \<Rightarrow> enat (x mod y) | \<infinity> \<Rightarrow> 0 | \<infinity> \<Rightarrow> \<infinity>) = 0
[PROOF STEP]
by (case_tac a, simp_all)


[STATEMENT]
lemma part_fn_Suc_imp_part_fn:
  "\<lbrakk>infinite Y; part_fn (Suc r) s Y f; y \<in> Y\<rbrakk> \<Longrightarrow> part_fn r s (Y - {y}) (\<lambda>u. f (insert y u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite Y; part_fn (Suc r) s Y f; y \<in> Y\<rbrakk> \<Longrightarrow> part_fn r s (Y - {y}) (\<lambda>u. f (insert y u))
[PROOF STEP]
by (simp add: part_fn_def nsets_def Pi_def subset_Diff_insert)


[STATEMENT]
lemma iT_Plus_Int: "(A \<inter> B) \<oplus> k = (A \<oplus> k) \<inter> (B \<oplus> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B \<oplus> k = (A \<oplus> k) \<inter> (B \<oplus> k)
[PROOF STEP]
by (simp add: iT_Plus_def image_Int)


[STATEMENT]
lemma is_expansion_aux_imp_smallo:
  assumes "is_expansion_aux xs f basis" "ms_exp_gt p (ms_aux_hd_exp xs)"
  shows   "f \<in> o(\<lambda>x. hd basis x powr p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_expansion_aux xs f basis
ms_exp_gt p (ms_aux_hd_exp xs)

goal (1 subgoal):
 1. f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
proof (cases rule: is_expansion_aux.cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLNil; \<forall>\<^sub>F x in at_top. f x = 0; length basis = Suc (expansion_level TYPE('a))\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
 2. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
case is_expansion_MSLNil
[PROOF STATE]
proof (state)
this:
xs = MSLNil
\<forall>\<^sub>F x in at_top. f x = 0
length basis = Suc (expansion_level TYPE('a))

goal (2 subgoals):
 1. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLNil; \<forall>\<^sub>F x in at_top. f x = 0; length basis = Suc (expansion_level TYPE('a))\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
 2. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
by (simp add: landau_o.small.in_cong[OF is_expansion_MSLNil(2)])
[PROOF STATE]
proof (state)
this:
f \<in> o(\<lambda>x. hd basis x powr p)

goal (1 subgoal):
 1. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
case (is_expansion_MSLCons xs C b e basis)
[PROOF STATE]
proof (state)
this:
xs = MSLCons (C, e) xs
basis = b # basis
is_expansion_aux xs (\<lambda>x. f x - eval C x * b x powr e) (b # basis)
is_expansion C basis
e < ?e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr ?e')
ms_exp_gt e (ms_aux_hd_exp xs)

goal (1 subgoal):
 1. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
is_expansion_aux xs f basis
ms_exp_gt p (ms_aux_hd_exp xs)
xs = MSLCons (C, e) xs
basis = b # basis
is_expansion_aux xs (\<lambda>x. f x - eval C x * b x powr e) (b # basis)
is_expansion C basis
e < ?e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr ?e')
ms_exp_gt e (ms_aux_hd_exp xs)
[PROOF STEP]
have "f \<in> o(\<lambda>x. b x powr p)"
[PROOF STATE]
proof (prove)
using this:
is_expansion_aux xs f basis
ms_exp_gt p (ms_aux_hd_exp xs)
xs = MSLCons (C, e) xs
basis = b # basis
is_expansion_aux xs (\<lambda>x. f x - eval C x * b x powr e) (b # basis)
is_expansion C basis
e < ?e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr ?e')
ms_exp_gt e (ms_aux_hd_exp xs)

goal (1 subgoal):
 1. f \<in> o(\<lambda>x. b x powr p)
[PROOF STEP]
by (intro is_expansion_MSLCons) (simp_all add: ms_aux_hd_exp_def)
[PROOF STATE]
proof (state)
this:
f \<in> o(\<lambda>x. b x powr p)

goal (1 subgoal):
 1. \<And>xsa C b e basisa. \<lbrakk>ms_exp_gt p (ms_aux_hd_exp xs); xs = MSLCons (C, e) xsa; basis = b # basisa; is_expansion_aux xsa (\<lambda>x. f x - eval C x * b x powr e) (b # basisa); is_expansion C basisa; \<And>e'. e < e' \<Longrightarrow> f \<in> o(\<lambda>x. b x powr e'); ms_exp_gt e (ms_aux_hd_exp xsa)\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> o(\<lambda>x. b x powr p)

goal (1 subgoal):
 1. f \<in> o(\<lambda>x. hd basis x powr p)
[PROOF STEP]
by (simp add: is_expansion_MSLCons)
[PROOF STATE]
proof (state)
this:
f \<in> o(\<lambda>x. hd basis x powr p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_within_tendsto_compose':
  fixes f::"'a::t2_space \<Rightarrow> 'b::topological_space"
  assumes "continuous (at a within s) f"
    "\<And>n. x n \<in> s"
    "(x \<longlongrightarrow> a) F "
  shows "((\<lambda>n. f (x n)) \<longlongrightarrow> f a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. f (x n)) \<longlongrightarrow> f a) F
[PROOF STEP]
by (auto intro!: continuous_within_tendsto_compose[OF assms(1)] simp add: assms)


[STATEMENT]
lemma assoc_naturality:
    assumes "arr f0" and "arr f1" and "arr f2"
    shows "\<a>[cod f0, cod f1, cod f2] \<cdot> ((f0 \<otimes> f1) \<otimes> f2) =
           (f0 \<otimes> f1 \<otimes> f2) \<cdot> \<a>[dom f0, dom f1, dom f2]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<a>[cod f0, cod f1, cod f2] \<cdot> ((f0 \<otimes> f1) \<otimes> f2) = (f0 \<otimes> f1 \<otimes> f2) \<cdot> \<a>[local.dom f0, local.dom f1, local.dom f2]
[PROOF STEP]
using assms \<alpha>.naturality
[PROOF STATE]
proof (prove)
using this:
arr f0
arr f1
arr f2
CCC.arr ?f \<Longrightarrow> \<alpha> (CCC.cod ?f) \<cdot> T.ToTC ?f = T.ToCT ?f \<cdot> \<alpha> (CCC.dom ?f)

goal (1 subgoal):
 1. \<a>[cod f0, cod f1, cod f2] \<cdot> ((f0 \<otimes> f1) \<otimes> f2) = (f0 \<otimes> f1 \<otimes> f2) \<cdot> \<a>[local.dom f0, local.dom f1, local.dom f2]
[PROOF STEP]
by auto


[STATEMENT]
lemma assoc_mult_mat_vec[simp]:
  "A \<in> carrier_mat n\<^sub>1 n\<^sub>2 \<Longrightarrow> B \<in> carrier_mat n\<^sub>2 n\<^sub>3 \<Longrightarrow> v \<in> carrier_vec n\<^sub>3
  \<Longrightarrow> (A * B) *\<^sub>v v = A *\<^sub>v (B *\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n\<^sub>1 n\<^sub>2; B \<in> carrier_mat n\<^sub>2 n\<^sub>3; v \<in> carrier_vec n\<^sub>3\<rbrakk> \<Longrightarrow> A * B *\<^sub>v v = A *\<^sub>v (B *\<^sub>v v)
[PROOF STEP]
by (intro eq_vecI, auto simp add: mult_mat_vec_def assoc_scalar_prod)


[STATEMENT]
lemma vwb_lens_iff_mwb_UNIV_src:
  "vwb_lens X \<longleftrightarrow> (mwb_lens X \<and> \<S>\<^bsub>X\<^esub> = UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vwb_lens X = (mwb_lens X \<and> \<S>\<^bsub>X\<^esub> = UNIV)
[PROOF STEP]
by (meson mwb_UNIV_src_is_vwb_lens vwb_lens_def wb_lens.source_UNIV)


[STATEMENT]
lemma (in information_space) mutual_information_eq_entropy_conditional_entropy':
  fixes Px :: "'b \<Rightarrow> real" and Py :: "'c \<Rightarrow> real" and Pxy :: "('b \<times> 'c) \<Rightarrow> real"
  assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"
  assumes Px: "distributed M S X Px" "\<And>x. x \<in> space S \<Longrightarrow> 0 \<le> Px x"
    and Py: "distributed M T Y Py" "\<And>x. x \<in> space T \<Longrightarrow> 0 \<le> Py x"
  assumes Pxy: "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) Pxy"
    "\<And>x. x \<in> space (S \<Otimes>\<^sub>M T) \<Longrightarrow> 0 \<le> Pxy x"
  assumes Ix: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Px (fst x)))"
  assumes Iy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Py (snd x)))"
  assumes Ixy: "integrable(S \<Otimes>\<^sub>M T) (\<lambda>x. Pxy x * log b (Pxy x))"
  shows  "mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y
[PROOF STEP]
using
    mutual_information_eq_entropy_conditional_entropy_distr[OF S T Px Py Pxy Ix Iy Ixy]
    conditional_entropy_eq_entropy[OF S T Py Pxy Ixy Iy]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> space S \<Longrightarrow> x \<in> space S; \<And>x. x \<in> space T \<Longrightarrow> x \<in> space T; \<And>x y. \<lbrakk>x \<in> space S; y \<in> space T\<rbrakk> \<Longrightarrow> (x, y) \<in> space (S \<Otimes>\<^sub>M T)\<rbrakk> \<Longrightarrow> mutual_information b S T X Y = entropy b S X + entropy b T Y - entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x))
\<lbrakk>\<And>x. x \<in> space T \<Longrightarrow> x \<in> space T; \<And>x y. \<lbrakk>x \<in> space S; y \<in> space T\<rbrakk> \<Longrightarrow> (x, y) \<in> space (S \<Otimes>\<^sub>M T)\<rbrakk> \<Longrightarrow> conditional_entropy b S T X Y = entropy b (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) - entropy b T Y

goal (1 subgoal):
 1. mutual_information b S T X Y = entropy b S X - conditional_entropy b S T X Y
[PROOF STEP]
by (simp add: space_pair_measure)


[STATEMENT]
lemma Infinitesimal_hrabs_iff [iff]: "\<bar>x\<bar> \<in> Infinitesimal \<longleftrightarrow> x \<in> Infinitesimal"
  for x :: hypreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>x\<bar> \<in> Infinitesimal) = (x \<in> Infinitesimal)
[PROOF STEP]
by (simp add: abs_if)


[STATEMENT]
lemma continuous_logarithm_on_simply_connected:
  fixes f :: "'a::real_normed_vector \<Rightarrow> complex"
  assumes contf: "continuous_on S f" and S: "simply_connected S" "locally path_connected S"
      and f: "\<And>z. z \<in> S \<Longrightarrow> f z \<noteq> 0"
  obtains g where "continuous_on S g" "\<And>x. x \<in> S \<Longrightarrow> f x = exp(g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on S g; \<And>x. x \<in> S \<Longrightarrow> f x = exp (g x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using covering_space_lift [OF covering_space_exp_punctured_plane S contf]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f ` S \<subseteq> - {0}; \<And>g. \<lbrakk>continuous_on S g; g ` S \<subseteq> UNIV; \<And>y. y \<in> S \<Longrightarrow> exp (g y) = f y\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>continuous_on S g; \<And>x. x \<in> S \<Longrightarrow> f x = exp (g x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (full_types) f imageE subset_Compl_singleton)


[STATEMENT]
lemma nn_integral_IntVal: "(\<integral>\<^sup>+x. f x \<partial>INTEG) = (\<integral>\<^sup>+x. f (IntVal x) \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (stock_measure INTEG) f = \<integral>\<^sup>+ x. f (IntVal x) \<partial>count_space UNIV
[PROOF STEP]
using measurable_embed_measure1[measurable (raw)]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ?g (?f x)) \<in> ?M \<rightarrow>\<^sub>M ?N \<Longrightarrow> ?g \<in> embed_measure ?M ?f \<rightarrow>\<^sub>M ?N

goal (1 subgoal):
 1. integral\<^sup>N (stock_measure INTEG) f = \<integral>\<^sup>+ x. f (IntVal x) \<partial>count_space UNIV
[PROOF STEP]
unfolding stock_measure.simps embed_measure_count_space[OF inj_IntVal, symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ?g (?f x)) \<in> ?M \<rightarrow>\<^sub>M ?N \<Longrightarrow> ?g \<in> embed_measure ?M ?f \<rightarrow>\<^sub>M ?N

goal (1 subgoal):
 1. integral\<^sup>N (embed_measure (count_space UNIV) IntVal) f = \<integral>\<^sup>+ x. f (IntVal x) \<partial>count_space UNIV
[PROOF STEP]
by (subst embed_measure_eq_distr[OF inj_IntVal], simp add: nn_integral_distr space_embed_measure)


[STATEMENT]
lemma iso_restrict:
  assumes groups:"group G" "group F"
  assumes HG:"subgroup H G"
  assumes \<phi>:"\<phi> \<in> iso G F"
  shows "(restrict \<phi> H) \<in> iso (G\<lparr>carrier := H\<rparr>) (F\<lparr>carrier := \<phi> ` H\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict \<phi> H \<in> Group.iso (G\<lparr>carrier := H\<rparr>) (F\<lparr>carrier := \<phi> ` H\<rparr>)
[PROOF STEP]
unfolding iso_def hom_def bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict \<phi> H \<in> {h \<in> {h \<in> carrier (G\<lparr>carrier := H\<rparr>) \<rightarrow> carrier (F\<lparr>carrier := \<phi> ` H\<rparr>). \<forall>x\<in>carrier (G\<lparr>carrier := H\<rparr>). \<forall>y\<in>carrier (G\<lparr>carrier := H\<rparr>). h (x \<otimes>\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> y) = h x \<otimes>\<^bsub>F\<lparr>carrier := \<phi> ` H\<rparr>\<^esub> h y}. (\<forall>x\<in>carrier (G\<lparr>carrier := H\<rparr>). \<forall>y\<in>carrier (G\<lparr>carrier := H\<rparr>). h x = h y \<longrightarrow> x = y) \<and> h ` carrier (G\<lparr>carrier := H\<rparr>) = carrier (F\<lparr>carrier := \<phi> ` H\<rparr>)}
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<in> H\<rbrakk> \<Longrightarrow> \<phi> (x \<otimes>\<^bsub>G\<^esub> y) = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 3. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix g h
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<in> H\<rbrakk> \<Longrightarrow> \<phi> (x \<otimes>\<^bsub>G\<^esub> y) = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 3. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "g \<in> H" "h \<in> H"
[PROOF STATE]
proof (state)
this:
g \<in> H
h \<in> H

goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<in> H\<rbrakk> \<Longrightarrow> \<phi> (x \<otimes>\<^bsub>G\<^esub> y) = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 3. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "g \<in> carrier G" "h \<in> carrier G"
[PROOF STATE]
proof (prove)
using this:
g \<in> H
h \<in> H

goal (1 subgoal):
 1. g \<in> carrier G &&& h \<in> carrier G
[PROOF STEP]
by (metis HG subgroup.mem_carrier)+
[PROOF STATE]
proof (state)
this:
g \<in> carrier G
h \<in> carrier G

goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<in> H\<rbrakk> \<Longrightarrow> \<phi> (x \<otimes>\<^bsub>G\<^esub> y) = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 3. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "\<phi> (g \<otimes>\<^bsub>G\<^esub> h) = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h"
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. \<phi> (g \<otimes>\<^bsub>G\<^esub> h) = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h
[PROOF STEP]
using \<phi>
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G
\<phi> \<in> Group.iso G F

goal (1 subgoal):
 1. \<phi> (g \<otimes>\<^bsub>G\<^esub> h) = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h
[PROOF STEP]
unfolding iso_def hom_def
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G
\<phi> \<in> {h \<in> {h \<in> carrier G \<rightarrow> carrier F. \<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h (x \<otimes>\<^bsub>G\<^esub> y) = h x \<otimes>\<^bsub>F\<^esub> h y}. bij_betw h (carrier G) (carrier F)}

goal (1 subgoal):
 1. \<phi> (g \<otimes>\<^bsub>G\<^esub> h) = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<phi> (g \<otimes>\<^bsub>G\<^esub> h) = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix g h
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "g \<in> H" "h \<in> H" "g \<otimes>\<^bsub>G\<^esub> h \<notin> H"
[PROOF STATE]
proof (state)
this:
g \<in> H
h \<in> H
g \<otimes>\<^bsub>G\<^esub> h \<notin> H

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "False"
[PROOF STATE]
proof (prove)
using this:
g \<in> H
h \<in> H
g \<otimes>\<^bsub>G\<^esub> h \<notin> H

goal (1 subgoal):
 1. False
[PROOF STEP]
using HG
[PROOF STATE]
proof (prove)
using this:
g \<in> H
h \<in> H
g \<otimes>\<^bsub>G\<^esub> h \<notin> H
subgroup H G

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding subgroup_def
[PROOF STATE]
proof (prove)
using this:
g \<in> H
h \<in> H
g \<otimes>\<^bsub>G\<^esub> h \<notin> H
(H \<subseteq> carrier G \<and> (\<forall>x y. x \<in> H \<longrightarrow> y \<in> H \<longrightarrow> x \<otimes>\<^bsub>G\<^esub> y \<in> H)) \<and> \<one>\<^bsub>G\<^esub> \<in> H \<and> (\<forall>x. x \<in> H \<longrightarrow> inv\<^bsub>G\<^esub> x \<in> H)

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

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; x \<otimes>\<^bsub>G\<^esub> y \<notin> H\<rbrakk> \<Longrightarrow> undefined = \<phi> x \<otimes>\<^bsub>F\<^esub> \<phi> y
 2. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "undefined = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h"
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. undefined = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
undefined = \<phi> g \<otimes>\<^bsub>F\<^esub> \<phi> h

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix g h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume g:"g \<in> H" and h:"h \<in> H" and eq:"\<phi> g = \<phi> h"
[PROOF STATE]
proof (state)
this:
g \<in> H
h \<in> H
\<phi> g = \<phi> h

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "g \<in> carrier G" "h \<in> carrier G"
[PROOF STATE]
proof (prove)
using this:
g \<in> H
h \<in> H
\<phi> g = \<phi> h

goal (1 subgoal):
 1. g \<in> carrier G &&& h \<in> carrier G
[PROOF STEP]
by (metis HG subgroup.mem_carrier)+
[PROOF STATE]
proof (state)
this:
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> H; y \<in> H; \<phi> x = \<phi> y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
\<phi> g = \<phi> h
g \<in> carrier G
h \<in> carrier G
[PROOF STEP]
show "g = h"
[PROOF STATE]
proof (prove)
using this:
\<phi> g = \<phi> h
g \<in> carrier G
h \<in> carrier G

goal (1 subgoal):
 1. g = h
[PROOF STEP]
using \<phi>
[PROOF STATE]
proof (prove)
using this:
\<phi> g = \<phi> h
g \<in> carrier G
h \<in> carrier G
\<phi> \<in> Group.iso G F

goal (1 subgoal):
 1. g = h
[PROOF STEP]
unfolding iso_def bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<phi> g = \<phi> h
g \<in> carrier G
h \<in> carrier G
\<phi> \<in> {h \<in> hom G F. (\<forall>x\<in>carrier G. \<forall>y\<in>carrier G. h x = h y \<longrightarrow> x = y) \<and> h ` carrier G = carrier F}

goal (1 subgoal):
 1. g = h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g = h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_vec_length_bis [simp]:
  assumes "x \<ge> 0"
  shows "\<parallel>col (complex_of_real(x) \<cdot>\<^sub>m |v\<rangle>) 0\<parallel> = x * \<parallel>v\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>col (complex_of_real x \<cdot>\<^sub>m |v\<rangle>) 0\<parallel> = x * \<parallel>v\<parallel>
[PROOF STEP]
using assms smult_ket_vec smult_vec_length ket_vec_col
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
|?x \<cdot>\<^sub>v ?v\<rangle> = ?x \<cdot>\<^sub>m |?v\<rangle>
0 \<le> ?x \<Longrightarrow> \<parallel>complex_of_real ?x \<cdot>\<^sub>v ?v\<parallel> = ?x * \<parallel>?v\<parallel>
col |?v\<rangle> 0 = ?v

goal (1 subgoal):
 1. \<parallel>col (complex_of_real x \<cdot>\<^sub>m |v\<rangle>) 0\<parallel> = x * \<parallel>v\<parallel>
[PROOF STEP]
by metis


[STATEMENT]
lemma signed_take_bit_numeral_minus_bit1 [simp]:
  \<open>signed_take_bit (numeral l) (- numeral (Num.Bit1 k)) = signed_take_bit (pred_numeral l) (- numeral k - 1) * 2 + (1 :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_take_bit (numeral l) (- numeral (num.Bit1 k)) = signed_take_bit (pred_numeral l) (- numeral k - 1) * 2 + 1
[PROOF STEP]
by (simp add: signed_take_bit_rec)


[STATEMENT]
lemma future_reach_And: "future_reach (And \<phi> \<psi>) = max (future_reach \<phi>) (future_reach \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. future_reach (And \<phi> \<psi>) = max (future_reach \<phi>) (future_reach \<psi>)
[PROOF STEP]
unfolding And_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. future_reach (Neg (Or (Neg \<phi>) (Neg \<psi>))) = max (future_reach \<phi>) (future_reach \<psi>)
[PROOF STEP]
by simp


[STATEMENT]
lemma states_min_mdpc: "states min_mdpc = {Inl t | t. Some t \<in> trivials R} \<union> {Inr True, Inr False}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. states local.min_mdpc = {Inl t |t. Some t \<in> trivials local.R} \<union> {Inr True, Inr False}
[PROOF STEP]
using trivials_subset_states[of R]
[PROOF STATE]
proof (prove)
using this:
trivials local.R \<subseteq> states local.R

goal (1 subgoal):
 1. states local.min_mdpc = {Inl t |t. Some t \<in> trivials local.R} \<union> {Inr True, Inr False}
[PROOF STEP]
by (auto simp add: min_mdpc_def states_map_mdpc image_comp split: if_splits)


[STATEMENT]
lemma Iff_trans: "H \<turnstile> A IFF B \<Longrightarrow> H \<turnstile> B IFF C \<Longrightarrow> H \<turnstile> A IFF C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<turnstile> A IFF B; H \<turnstile> B IFF C\<rbrakk> \<Longrightarrow> H \<turnstile> A IFF C
[PROOF STEP]
unfolding Iff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<turnstile> (A IMP B) AND (B IMP A); H \<turnstile> (B IMP C) AND (C IMP B)\<rbrakk> \<Longrightarrow> H \<turnstile> (A IMP C) AND (C IMP A)
[PROOF STEP]
by (metis cnj_E1 cnj_E2 cnj_I dsj_Semicong_1 dsj_commute)


[STATEMENT]
lemma  bernoulli_stream_pref_prob':
  fixes x
  assumes "M = bernoulli_stream p"
and "p \<le> 1" and "0 \<le> p"
  shows "emeasure M {w\<in> space M. (stake n w = stake n x)} = (\<Prod>i\<in>{0..<n}. prob_component p x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
proof (cases "Suc 0 \<le> n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
 2. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Suc 0 \<le> n

goal (2 subgoals):
 1. Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
 2. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
hence "emeasure M {w\<in> space M. (stake n w = stake n x)} = (\<Prod>i\<in>{0..n -1}. prob_component p x i)"
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> n

goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> n
M = bernoulli_stream p
p \<le> 1
0 \<le> p

goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})
[PROOF STEP]
by (simp add: bernoulli_stream_pref_prob)
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})

goal (2 subgoals):
 1. Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
 2. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})

goal (2 subgoals):
 1. Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
 2. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
have "(\<Prod>i\<in>{0..n -1}. prob_component p x i) = (\<Prod>i\<in>{0..<n}. prob_component p x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod (prob_component p x) {0..n - 1} = prod (prob_component p x) {0..<n}
[PROOF STEP]
proof (rule prod.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {0..n - 1} = {0..<n}
 2. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> prob_component p x xa = prob_component p x xa
[PROOF STEP]
show "{0..n - 1} = {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..n - 1} = {0..<n}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
Suc 0 \<le> n

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

goal (1 subgoal):
 1. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> prob_component p x xa = prob_component p x xa
[PROOF STEP]
show "\<And>xa. xa \<in> {0..<n} \<Longrightarrow> prob_component p x xa = prob_component p x xa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {0..<n} \<Longrightarrow> prob_component p x xa = prob_component p x xa
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?xa \<in> {0..<n} \<Longrightarrow> prob_component p x ?xa = prob_component p x ?xa

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prod (prob_component p x) {0..n - 1} = prod (prob_component p x) {0..<n}

goal (2 subgoals):
 1. Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
 2. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})
prod (prob_component p x) {0..n - 1} = prod (prob_component p x) {0..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..n - 1})
prod (prob_component p x) {0..n - 1} = prod (prob_component p x) {0..<n}

goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> Suc 0 \<le> n

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
hence "n = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> Suc 0 \<le> n

goal (1 subgoal):
 1. n = 0
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> Suc 0 \<le> n
\<not> Suc 0 \<le> n

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

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
have "{w\<in> space M. (stake n w = stake n x)} = space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w \<in> space M. stake n w = stake n x} = space M
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {w \<in> space M. stake n w = stake n x} \<subseteq> space M
 2. space M \<subseteq> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
show "{w \<in> space M. stake n w = stake n x} \<subseteq> space M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w \<in> space M. stake n w = stake n x} \<subseteq> space M
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {w \<in> space M. stake n w = stake n x} \<Longrightarrow> xa \<in> space M
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {w \<in> space M. stake n w = stake n x} \<Longrightarrow> xa \<in> space M
[PROOF STEP]
assume "w\<in> {w \<in> space M. stake n w = stake n x}"
[PROOF STATE]
proof (state)
this:
w \<in> {w \<in> space M. stake n w = stake n x}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {w \<in> space M. stake n w = stake n x} \<Longrightarrow> xa \<in> space M
[PROOF STEP]
thus "w \<in> space M"
[PROOF STATE]
proof (prove)
using this:
w \<in> {w \<in> space M. stake n w = stake n x}

goal (1 subgoal):
 1. w \<in> space M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> space M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{w \<in> space M. stake n w = stake n x} \<subseteq> space M

goal (1 subgoal):
 1. space M \<subseteq> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
show "space M \<subseteq> {w \<in> space M. stake n w = stake n x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space M \<subseteq> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> space M \<Longrightarrow> xa \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> space M \<Longrightarrow> xa \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
assume "w\<in> space M"
[PROOF STATE]
proof (state)
this:
w \<in> space M

goal (1 subgoal):
 1. \<And>xa. xa \<in> space M \<Longrightarrow> xa \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
have "stake 0 w = stake 0 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stake 0 w = stake 0 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
stake 0 w = stake 0 x

goal (1 subgoal):
 1. \<And>xa. xa \<in> space M \<Longrightarrow> xa \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
hence "stake n w = stake n x"
[PROOF STATE]
proof (prove)
using this:
stake 0 w = stake 0 x

goal (1 subgoal):
 1. stake n w = stake n x
[PROOF STEP]
using \<open>n = 0\<close>
[PROOF STATE]
proof (prove)
using this:
stake 0 w = stake 0 x
n = 0

goal (1 subgoal):
 1. stake n w = stake n x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
stake n w = stake n x

goal (1 subgoal):
 1. \<And>xa. xa \<in> space M \<Longrightarrow> xa \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
thus "w\<in> {w \<in> space M. stake n w = stake n x}"
[PROOF STATE]
proof (prove)
using this:
stake n w = stake n x

goal (1 subgoal):
 1. w \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
using \<open>w\<in> space M\<close>
[PROOF STATE]
proof (prove)
using this:
stake n w = stake n x
w \<in> space M

goal (1 subgoal):
 1. w \<in> {w \<in> space M. stake n w = stake n x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> {w \<in> space M. stake n w = stake n x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
space M \<subseteq> {w \<in> space M. stake n w = stake n x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{w \<in> space M. stake n w = stake n x} = space M

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
hence "emeasure M {w \<in> space M. stake n w = stake n x} = emeasure M (space M)"
[PROOF STATE]
proof (prove)
using this:
{w \<in> space M. stake n w = stake n x} = space M

goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = emeasure M (space M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = emeasure M (space M)

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = emeasure M (space M)

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (space M) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M = bernoulli_stream p
p \<le> 1
0 \<le> p

goal (1 subgoal):
 1. emeasure M (space M) = 1
[PROOF STEP]
by (simp add: bernoulli_stream_def prob_space.emeasure_space_1
        prob_space.prob_space_stream_space prob_space_measure_pmf)
[PROOF STATE]
proof (state)
this:
emeasure M (space M) = 1

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (space M) = 1

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
have "... = (\<Prod>i\<in>{0..<n}. prob_component p x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
using \<open>n = 0\<close>
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. 1 = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 = ennreal (prod (prob_component p x) {0..<n})

goal (1 subgoal):
 1. \<not> Suc 0 \<le> n \<Longrightarrow> emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})

goal (1 subgoal):
 1. emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M {w \<in> space M. stake n w = stake n x} = ennreal (prod (prob_component p x) {0..<n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_full_pmdl_subset:
  assumes "is_full_pmdl B1" and "is_full_pmdl B2"
    and "component_of_term ` Keys B1 \<subseteq> component_of_term ` Keys B2"
  shows "pmdl B1 \<subseteq> pmdl B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl B1 \<subseteq> pmdl B2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pmdl B1 \<Longrightarrow> x \<in> pmdl B2
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> pmdl B1 \<Longrightarrow> x \<in> pmdl B2
[PROOF STEP]
assume "p \<in> pmdl B1"
[PROOF STATE]
proof (state)
this:
p \<in> pmdl B1

goal (1 subgoal):
 1. \<And>x. x \<in> pmdl B1 \<Longrightarrow> x \<in> pmdl B2
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
is_full_pmdl B2
[PROOF STEP]
show "p \<in> pmdl B2"
[PROOF STATE]
proof (prove)
using this:
is_full_pmdl B2

goal (1 subgoal):
 1. p \<in> pmdl B2
[PROOF STEP]
proof (rule is_full_pmdlD)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
have "component_of_term ` keys p \<subseteq> component_of_term ` Keys (pmdl B1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys (pmdl B1)
[PROOF STEP]
by (rule image_mono, rule keys_subset_Keys, fact)
[PROOF STATE]
proof (state)
this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys (pmdl B1)

goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys (pmdl B1)

goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
have "... = component_of_term ` Keys B1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. component_of_term ` Keys (pmdl B1) = component_of_term ` Keys B1
[PROOF STEP]
by (fact components_pmdl)
[PROOF STATE]
proof (state)
this:
component_of_term ` Keys (pmdl B1) = component_of_term ` Keys B1

goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys B1
[PROOF STEP]
show "component_of_term ` keys p \<subseteq> component_of_term ` Keys B2"
[PROOF STATE]
proof (prove)
using this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys B1

goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys B1
component_of_term ` Keys B1 \<subseteq> component_of_term ` Keys B2

goal (1 subgoal):
 1. component_of_term ` keys p \<subseteq> component_of_term ` Keys B2
[PROOF STEP]
by (rule subset_trans)
[PROOF STATE]
proof (state)
this:
component_of_term ` keys p \<subseteq> component_of_term ` Keys B2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p \<in> pmdl B2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bl_sbin_sign: "hd (bin_to_bl (Suc n) w) = (bin_sign (signed_take_bit n w) = -1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (bin_to_bl (Suc n) w) = (bin_sign (signed_take_bit n w) = - 1)
[PROOF STEP]
unfolding bin_to_bl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (bin_to_bl_aux (Suc n) w []) = (bin_sign (signed_take_bit n w) = - 1)
[PROOF STEP]
by (rule bl_sbin_sign_aux)


[STATEMENT]
lemma fst_Gauss_Jordan_column_k:
assumes "i\<le>nrows A"
shows "fst (Gauss_Jordan_column_k (i, A) k) \<le> nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k (i, A) k) \<le> nrows A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<le> nrows A

goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k (i, A) k) \<le> nrows A
[PROOF STEP]
unfolding Gauss_Jordan_column_k_def Let_def
[PROOF STATE]
proof (prove)
using this:
i \<le> nrows A

goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat (fst (i, A)). snd (i, A) $ m $ mod_type_class.from_nat k = (0::'a)) \<or> fst (i, A) = nrows (snd (i, A)) then (fst (i, A), snd (i, A)) else (fst (i, A) + 1, Gauss_Jordan_in_ij (snd (i, A)) (mod_type_class.from_nat (fst (i, A))) (mod_type_class.from_nat k))) \<le> nrows A
[PROOF STEP]
by auto