[STATEMENT]
lemma EH\<^sub>N_bounds':
  fixes n::nat
  assumes "p \<in> {0<..<1}" "0 < n"
  shows "- harm n / ln q - 1 \<le> EH\<^sub>N n"
     "EH\<^sub>N n \<le> - harm n / ln q"
     "integrable (H\<^sub>N n) real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n &&& EH\<^sub>N n \<le> - harm n / ln q &&& integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
define f where "f = (\<lambda>x. 1 - (1 - q ^ x) ^ n)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x. 1 - (1 - q ^ x) ^ n)

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
define f' where "f' = (\<lambda>x. 1 - (1 - q powr x) ^ n)"
[PROOF STATE]
proof (state)
this:
f' = (\<lambda>x. 1 - (1 - q powr x) ^ n)

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have q: "q \<in> {0<..<1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<in> {0<..<1}
[PROOF STEP]
unfolding q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - p \<in> {0<..<1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
0 < n

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

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have f_descending: "f y \<le> f x" if "x \<le> y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f y \<le> f x
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (1 - q ^ y) ^ n \<le> 1 - (1 - q ^ x) ^ n
[PROOF STEP]
using that q
[PROOF STATE]
proof (prove)
using this:
x \<le> y
q \<in> {0<..<1}

goal (1 subgoal):
 1. 1 - (1 - q ^ y) ^ n \<le> 1 - (1 - q ^ x) ^ n
[PROOF STEP]
by (auto intro!: power_mono simp add: power_decreasing power_le_one_iff)
[PROOF STATE]
proof (state)
this:
?x2 \<le> ?y2 \<Longrightarrow> f ?y2 \<le> f ?x2

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have f'_descending: "f' y \<le> f' x" if "x \<le> y" "0 \<le> x" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' y \<le> f' x
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (1 - q powr y) ^ n \<le> 1 - (1 - q powr x) ^ n
[PROOF STEP]
using that q
[PROOF STATE]
proof (prove)
using this:
x \<le> y
0 \<le> x
q \<in> {0<..<1}

goal (1 subgoal):
 1. 1 - (1 - q powr y) ^ n \<le> 1 - (1 - q powr x) ^ n
[PROOF STEP]
by (auto intro!: power_mono simp add: ln_powr powr_def mult_nonneg_nonpos)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x2 \<le> ?y2; 0 \<le> ?x2\<rbrakk> \<Longrightarrow> f' ?y2 \<le> f' ?x2

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have [simp]: "harm n / ln q <= 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm n / ln q \<le> 0
[PROOF STEP]
using harm_nonneg ln_ge_zero_imp_ge_one q
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<le> harm ?n
\<lbrakk>0 \<le> ln ?x; 0 < ?x\<rbrakk> \<Longrightarrow> 1 \<le> ?x
q \<in> {0<..<1}

goal (1 subgoal):
 1. harm n / ln q \<le> 0
[PROOF STEP]
by (intro divide_nonneg_neg) auto
[PROOF STATE]
proof (state)
this:
harm n / ln q \<le> 0

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have f_nn_integral_harm:
    "- harm n / ln q \<le> \<integral>\<^sup>+ x. (f x) \<partial>count_space UNIV"
    "(\<integral>\<^sup>+ i. f (i + 1) \<partial>count_space UNIV) \<le> - harm n / ln q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV &&& \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
have "(\<integral>\<^sup>+ i. f (i + 1) \<partial>count_space UNIV) = (\<integral>\<^sup>+x\<in>{0::real..}. (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel
[PROOF STEP]
using nn_integral_nats_reals
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ i. ennreal (?f i) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (?f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+x\<in>{0::real..}. ennreal (f' (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel
[PROOF STEP]
have "0 \<le> x \<Longrightarrow> (1 - q * q ^ nat \<lfloor>x\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>x\<rfloor>)) ^ n" for x::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (1 - q * q ^ nat \<lfloor>x\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>x\<rfloor>)) ^ n
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (1 - q * q ^ nat \<lfloor>x\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>x\<rfloor>)) ^ n
[PROOF STEP]
by (subst powr_realpow [symmetric]) (auto simp: powr_add)
[PROOF STATE]
proof (state)
this:
0 \<le> ?x2 \<Longrightarrow> (1 - q * q ^ nat \<lfloor>?x2\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>?x2\<rfloor>)) ^ n

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> ?x2 \<Longrightarrow> (1 - q * q ^ nat \<lfloor>?x2\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>?x2\<rfloor>)) ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?x2 \<Longrightarrow> (1 - q * q ^ nat \<lfloor>?x2\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>?x2\<rfloor>)) ^ n

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel
[PROOF STEP]
unfolding f_def f'_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?x2 \<Longrightarrow> (1 - q * q ^ nat \<lfloor>?x2\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>?x2\<rfloor>)) ^ n

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q ^ (nat \<lfloor>x\<rfloor> + 1)) ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr real (nat \<lfloor>x\<rfloor> + 1)) ^ n)\<partial>lborel
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?x2 \<Longrightarrow> (1 - q * q ^ nat \<lfloor>?x2\<rfloor>) ^ n = (1 - q powr (1 + real_of_int \<lfloor>?x2\<rfloor>)) ^ n
q \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q ^ (nat \<lfloor>x\<rfloor> + 1)) ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr real (nat \<lfloor>x\<rfloor> + 1)) ^ n)\<partial>lborel
[PROOF STEP]
by (auto intro!: nn_integral_cong ennreal_cong  simp add: powr_real_of_int indicator_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
have "\<dots> \<le> set_nn_integral lborel {0..} f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel
[PROOF STEP]
have "x \<le> 1 + real_of_int \<lfloor>x\<rfloor>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> 1 + real_of_int \<lfloor>x\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
?x2 \<le> 1 + real_of_int \<lfloor>?x2\<rfloor>

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<le> 1 + real_of_int \<lfloor>?x2\<rfloor>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x2 \<le> 1 + real_of_int \<lfloor>?x2\<rfloor>

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel
[PROOF STEP]
by (auto simp add: indicator_def intro!: f'_descending nn_integral_mono ennreal_leI)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor> + 1)))\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
have harm_integral_f': "\<dots> = - harm n / ln q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel = ennreal (- harm n / ln q)
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (- harm n / ln q)
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (- harm n / ln q)
[PROOF STEP]
by (auto intro!: ennreal_cong
          simp add: one_minus_one_minus_q_x_n_nn_integral one_minus_one_minus_q_x_n_integral)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel = ennreal (- harm n / ln q)

goal (2 subgoals):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
 2. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
show "(\<integral>\<^sup>+ i. f (i + 1) \<partial>count_space UNIV) \<le> - harm n / ln q"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
note harm_integral_f'[symmetric]
[PROOF STATE]
proof (state)
this:
ennreal (- harm n / ln q) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (- harm n / ln q) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
have "set_nn_integral lborel {0..} f' \<le> \<integral>\<^sup>+x\<in>{0::real..}. f' (nat \<lfloor>x\<rfloor>)\<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel
[PROOF STEP]
using assms f'_descending
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
0 < n
\<lbrakk>?x2 \<le> ?y2; 0 \<le> ?x2\<rbrakk> \<Longrightarrow> f' ?y2 \<le> f' ?x2

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel
[PROOF STEP]
by (auto simp add: indicator_def intro!: nn_integral_mono ennreal_leI)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' x)\<partial>lborel \<le> \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+x\<in>{0::real..}. f (nat \<lfloor>x\<rfloor>)\<partial>lborel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
unfolding f_def f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr real (nat \<lfloor>x\<rfloor>)) ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q ^ nat \<lfloor>x\<rfloor>) ^ n)\<partial>lborel
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr real (nat \<lfloor>x\<rfloor>)) ^ n)\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q ^ nat \<lfloor>x\<rfloor>) ^ n)\<partial>lborel
[PROOF STEP]
by (auto intro!: nn_integral_cong ennreal_cong simp add: powr_real_of_int indicator_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f' (real (nat \<lfloor>x\<rfloor>)))\<partial>lborel = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+ x. f x \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
using nn_integral_nats_reals
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ i. ennreal (?f i) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (?f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
show "- harm n / ln q \<le> \<integral>\<^sup>+ x. f x \<partial>count_space UNIV"
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
have f1_abs_summable_on: "(\<lambda>i. f (i + 1)) abs_summable_on UNIV"
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. (\<lambda>i. f (i + 1)) abs_summable_on UNIV
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (1 - (1 - q ^ x) ^ n) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (1 - (1 - q ^ (x + 1)) ^ n) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. (\<lambda>i. 1 - (1 - q ^ (i + 1)) ^ n) abs_summable_on UNIV
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (1 - (1 - q ^ x) ^ n) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (1 - (1 - q ^ (x + 1)) ^ n) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
q \<in> {0<..<1}

goal (1 subgoal):
 1. (\<lambda>i. 1 - (1 - q ^ (i + 1)) ^ n) abs_summable_on UNIV
[PROOF STEP]
by (intro nn_integral_finite_imp_abs_sumable_on')
      (auto simp add: f_def le_less_trans intro!: power_le_one mult_le_one)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. f (i + 1)) abs_summable_on UNIV

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. f (i + 1)) abs_summable_on UNIV
[PROOF STEP]
have f_abs_summable_on: "f abs_summable_on {1..}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. f (i + 1)) abs_summable_on UNIV

goal (1 subgoal):
 1. f abs_summable_on {1..}
[PROOF STEP]
using Suc_le_lessD greaterThan_0
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. f (i + 1)) abs_summable_on UNIV
Suc ?m \<le> ?n \<Longrightarrow> ?m < ?n
{0<..} = range Suc

goal (1 subgoal):
 1. f abs_summable_on {1..}
[PROOF STEP]
by (subst abs_summable_on_reindex_bij_betw[symmetric, where g="\<lambda>x. x + 1" and A="UNIV"]) auto
[PROOF STATE]
proof (state)
this:
f abs_summable_on {1..}

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f abs_summable_on {1..}

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
have "(f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
have "((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) =
          ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..})
[PROOF STEP]
by (auto intro!: measure_prob_cong_0 abs_summable_on_cong)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..})

goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..})

goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
have "\<dots> = (f abs_summable_on {1..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..}) = (f abs_summable_on {1..})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
0 < n

goal (1 subgoal):
 1. ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..}) = (f abs_summable_on {1..})
[PROOF STEP]
by (intro abs_summable_on_cong) (auto simp add: f_def prob_Max_IID_geometric_greaterThan)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x - 1<..}) abs_summable_on {1..}) = (f abs_summable_on {1..})

goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) = (f abs_summable_on {1..})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}) = (f abs_summable_on {1..})

goal (1 subgoal):
 1. (f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f abs_summable_on {1..}) = ((\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..})

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}
[PROOF STEP]
have EH\<^sub>N_sum:
    "EH\<^sub>N n = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..})"
    "integrable (measure_pmf (H\<^sub>N n)) real"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}

goal (1 subgoal):
 1. EH\<^sub>N n = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..}) &&& integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
unfolding EH\<^sub>N_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}

goal (1 subgoal):
 1. measure_pmf.expectation (H\<^sub>N n) real = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..}) &&& integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
using expectation_prob_atLeast
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. measure_pmf.prob (H\<^sub>N n) {x..}) abs_summable_on {1..}
(\<lambda>i. measure_pmf.prob ?N {i..}) abs_summable_on {1..} \<Longrightarrow> measure_pmf.expectation ?N real = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob ?N {i..})
(\<lambda>i. measure_pmf.prob ?N {i..}) abs_summable_on {1..} \<Longrightarrow> integrable (measure_pmf ?N) real

goal (1 subgoal):
 1. measure_pmf.expectation (H\<^sub>N n) real = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..}) &&& integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..})
integrable (measure_pmf (H\<^sub>N n)) real

goal (3 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
 3. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
EH\<^sub>N n = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..})
integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
show "integrable (measure_pmf (H\<^sub>N n)) real"
[PROOF STATE]
proof (prove)
using this:
EH\<^sub>N n = (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..})
integrable (measure_pmf (H\<^sub>N n)) real

goal (1 subgoal):
 1. integrable (measure_pmf (H\<^sub>N n)) real
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable (measure_pmf (H\<^sub>N n)) real

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
have EH\<^sub>N_sum': "EH\<^sub>N n = infsetsum f {1..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
have "EH\<^sub>N n = (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EH\<^sub>N n = (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..})
[PROOF STEP]
unfolding EH\<^sub>N_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ai\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {i..}) = (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..})
[PROOF STEP]
by (auto intro!: measure_prob_cong_0 infsetsum_cong)
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..})

goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..})

goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
have "\<dots> = infsetsum f {1..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..}) = infsetsum f {1..}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
0 < n

goal (1 subgoal):
 1. (\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..}) = infsetsum f {1..}
[PROOF STEP]
by (intro infsetsum_cong) (auto simp add: f_def prob_Max_IID_geometric_greaterThan)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>ak\<in>{1..}. measure_pmf.prob (H\<^sub>N n) {k - 1<..}) = infsetsum f {1..}

goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
EH\<^sub>N n = infsetsum f {1..}

goal (1 subgoal):
 1. EH\<^sub>N n = infsetsum f {1..}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = infsetsum f {1..}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = infsetsum f {1..}

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n = infsetsum f {1..}

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
have "\<dots> = (\<Sum>\<^sub>ak. f (k + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f {1..} = (\<Sum>\<^sub>ak. f (k + 1))
[PROOF STEP]
using Suc_le_lessD greaterThan_0
[PROOF STATE]
proof (prove)
using this:
Suc ?m \<le> ?n \<Longrightarrow> ?m < ?n
{0<..} = range Suc

goal (1 subgoal):
 1. infsetsum f {1..} = (\<Sum>\<^sub>ak. f (k + 1))
[PROOF STEP]
by (subst infsetsum_reindex_bij_betw[symmetric, where g="\<lambda>x. x + 1" and A="UNIV"]) auto
[PROOF STATE]
proof (state)
this:
infsetsum f {1..} = (\<Sum>\<^sub>ak. f (k + 1))

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
infsetsum f {1..} = (\<Sum>\<^sub>ak. f (k + 1))

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
have "ennreal \<dots> = (\<integral>\<^sup>+x\<in>{0::real..}. f (nat \<lfloor>x\<rfloor> + 1)\<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (\<Sum>\<^sub>ak. f (k + 1)) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel
[PROOF STEP]
using f1_abs_summable_on q
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. f (i + 1)) abs_summable_on UNIV
q \<in> {0<..<1}

goal (1 subgoal):
 1. ennreal (\<Sum>\<^sub>ak. f (k + 1)) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel
[PROOF STEP]
by (intro infsetsum_set_nn_integral_reals) (auto simp add: f_def mult_le_one power_le_one)
[PROOF STATE]
proof (state)
this:
ennreal (\<Sum>\<^sub>ak. f (k + 1)) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (\<Sum>\<^sub>ak. f (k + 1)) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+ i. f (i + 1) \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV
[PROOF STEP]
using nn_integral_nats_reals
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ i. ennreal (?f i) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (?f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor> + 1))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
have "\<dots> \<le> - harm n / ln q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
using f_nn_integral_harm
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (2 subgoals):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
 2. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (EH\<^sub>N n) \<le> ennreal (- harm n / ln q)
[PROOF STEP]
show "EH\<^sub>N n \<le> - harm n / ln q"
[PROOF STATE]
proof (prove)
using this:
ennreal (EH\<^sub>N n) \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. EH\<^sub>N n \<le> - harm n / ln q
[PROOF STEP]
by (subst (asm) ennreal_le_iff) (auto)
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n \<le> - harm n / ln q

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
have "EH\<^sub>N n + 1 = (\<Sum>\<^sub>ax\<in>{Suc 0..}. f x) + (\<Sum>\<^sub>ax\<in>{0}. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EH\<^sub>N n + 1 = infsetsum f {Suc 0..} + infsetsum f {0}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..<1}
0 < n

goal (1 subgoal):
 1. EH\<^sub>N n + 1 = infsetsum f {Suc 0..} + infsetsum f {0}
[PROOF STEP]
by (subst EH\<^sub>N_sum') (auto simp add: f_def)
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n + 1 = infsetsum f {Suc 0..} + infsetsum f {0}

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
EH\<^sub>N n + 1 = infsetsum f {Suc 0..} + infsetsum f {0}

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
have "\<dots> = infsetsum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f {Suc 0..} + infsetsum f {0} = infsetsum f UNIV
[PROOF STEP]
using f_abs_summable_on
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on {1..}

goal (1 subgoal):
 1. infsetsum f {Suc 0..} + infsetsum f {0} = infsetsum f UNIV
[PROOF STEP]
by (subst infsetsum_Un_disjoint[symmetric]) (auto intro!: infsetsum_cong)
[PROOF STATE]
proof (state)
this:
infsetsum f {Suc 0..} + infsetsum f {0} = infsetsum f UNIV

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
infsetsum f {Suc 0..} + infsetsum f {0} = infsetsum f UNIV

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+x\<in>{0::real..}. f (nat \<lfloor>x\<rfloor>)\<partial>lborel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
have "f abs_summable_on ({0} \<union> {1..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on {0} \<union> {1..}
[PROOF STEP]
using f_abs_summable_on
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on {1..}

goal (1 subgoal):
 1. f abs_summable_on {0} \<union> {1..}
[PROOF STEP]
by (intro abs_summable_on_union) (auto)
[PROOF STATE]
proof (state)
this:
f abs_summable_on {0} \<union> {1..}

goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f abs_summable_on {0} \<union> {1..}

goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
have "{0::nat} \<union> {1..} = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0} \<union> {1..} = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0} \<union> {1..} = UNIV

goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f abs_summable_on UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on UNIV

goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
using q
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on UNIV
q \<in> {0<..<1}

goal (1 subgoal):
 1. ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel
[PROOF STEP]
by (intro infsetsum_set_nn_integral_reals) (auto simp add: f_def mult_le_one power_le_one)
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (infsetsum f UNIV) = \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+ x. f x \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
using nn_integral_nats_reals
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ i. ennreal (?f i) \<partial>count_space UNIV = \<integral>\<^sup>+x\<in>{0..}. ennreal (?f (nat \<lfloor>x\<rfloor>))\<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (f (nat \<lfloor>x\<rfloor>))\<partial>lborel = \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
have "... \<ge> - harm n / ln q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
using f_nn_integral_harm
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
\<integral>\<^sup>+ x. ennreal (f (x + 1)) \<partial>count_space UNIV \<le> ennreal (- harm n / ln q)

goal (1 subgoal):
 1. ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ennreal (- harm n / ln q) \<le> \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space UNIV

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (- harm n / ln q) \<le> ennreal (EH\<^sub>N n + 1)
[PROOF STEP]
have "- harm n / ln q \<le> EH\<^sub>N n + 1"
[PROOF STATE]
proof (prove)
using this:
ennreal (- harm n / ln q) \<le> ennreal (EH\<^sub>N n + 1)

goal (1 subgoal):
 1. - harm n / ln q \<le> EH\<^sub>N n + 1
[PROOF STEP]
by (subst (asm) ennreal_le_iff) (auto simp add: EH\<^sub>N_def)
[PROOF STATE]
proof (state)
this:
- harm n / ln q \<le> EH\<^sub>N n + 1

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- harm n / ln q \<le> EH\<^sub>N n + 1
[PROOF STEP]
show "- harm n / ln q - 1 \<le> EH\<^sub>N n"
[PROOF STATE]
proof (prove)
using this:
- harm n / ln q \<le> EH\<^sub>N n + 1

goal (1 subgoal):
 1. - harm n / ln q - 1 \<le> EH\<^sub>N n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- harm n / ln q - 1 \<le> EH\<^sub>N n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reverseN_tl_hd: "0 < n \<Longrightarrow> xs \<noteq> [] \<Longrightarrow> reverseN n xs ys = reverseN (n - (Suc 0)) (tl xs) (hd xs #ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; xs \<noteq> []\<rbrakk> \<Longrightarrow> reverseN n xs ys = reverseN (n - Suc 0) (tl xs) (hd xs # ys)
[PROOF STEP]
by (simp add: reverseN_step del: reverseN_def)


[STATEMENT]
lemma P_sup_True[simp]: "P_sup t (\<lambda>\<omega>. True) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_sup t (\<lambda>\<omega>. True) = 1
[PROOF STEP]
using T.emeasure_space_1
[PROOF STATE]
proof (prove)
using this:
emeasure (T ?cfg) (space (T ?cfg)) = 1

goal (1 subgoal):
 1. P_sup t (\<lambda>\<omega>. True) = 1
[PROOF STEP]
by (auto simp add: P_sup_def SUP_constant)


[STATEMENT]
lemma myopt_type_def: "type_definition
  (\<lambda>X. if card (Rep_myopt X) = 1 then Some (the_elem (Rep_myopt X)) else None)
  (\<lambda>x. Abs_myopt (case x of Some x \<Rightarrow> {x} | _ \<Rightarrow> {}))
  (UNIV :: 'a option set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. type_definition (\<lambda>X. if card (Rep_myopt X) = 1 then Some (the_elem (Rep_myopt X)) else None) (\<lambda>x. Abs_myopt (case x of None \<Rightarrow> {} | Some x \<Rightarrow> {x})) UNIV
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. (if card (Rep_myopt x) = 1 then Some (the_elem (Rep_myopt x)) else None) \<in> UNIV
 2. \<And>x. Abs_myopt (case if card (Rep_myopt x) = 1 then Some (the_elem (Rep_myopt x)) else None of None \<Rightarrow> {} | Some x \<Rightarrow> {x}) = x
 3. \<And>y. y \<in> UNIV \<Longrightarrow> (if card (Rep_myopt (Abs_myopt (case y of None \<Rightarrow> {} | Some x \<Rightarrow> {x}))) = 1 then Some (the_elem (Rep_myopt (Abs_myopt (case y of None \<Rightarrow> {} | Some x \<Rightarrow> {x})))) else None) = y
[PROOF STEP]
apply (auto simp: Abs_myopt_inverse dest!: card_eq_SucD split: option.splits)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x b. Rep_myopt x = {b} \<Longrightarrow> Abs_myopt {b} = x
 2. \<And>x. card (Rep_myopt x) \<noteq> Suc 0 \<Longrightarrow> Abs_myopt {} = x
[PROOF STEP]
apply (metis Rep_myopt_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. card (Rep_myopt x) \<noteq> Suc 0 \<Longrightarrow> Abs_myopt {} = x
[PROOF STEP]
apply (metis One_nat_def Rep_myopt Rep_myopt_inverse Suc_le_mono card_0_eq le0 le_antisym mem_Collect_eq nat.exhaust)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sqInt_lem3: "\<lbrakk> A \<sqsubseteq> A'; B \<sqsubseteq> B' \<rbrakk> \<Longrightarrow> A \<sqinter> B \<sqsubseteq> A' \<sqinter> B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<sqsubseteq> A'; B \<sqsubseteq> B'\<rbrakk> \<Longrightarrow> A \<sqinter> B \<sqsubseteq> A' \<sqinter> B'
[PROOF STEP]
by(auto simp add: hyperset_defs)


[STATEMENT]
lemma starfun_ln_inverse: "\<And>x. 0 < x \<Longrightarrow> ( *f* real_ln) (inverse x) = -( *f* ln) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < x \<Longrightarrow> (*f* real_ln) (inverse x) = - (*f* real_ln) x
[PROOF STEP]
by transfer (rule ln_inverse)


[STATEMENT]
lemma fst_hd_drop_zip:
  assumes "n < length x"
      and "length x = length y"
  shows "fst (hd (drop n (zip x y))) = hd (drop n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (hd (drop n (zip x y))) = hd (drop n x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < length x
length x = length y

goal (1 subgoal):
 1. fst (hd (drop n (zip x y))) = hd (drop n x)
[PROOF STEP]
by (induct x arbitrary: n y,auto)
     (metis (no_types, lifting) Cons_nth_drop_Suc drop_zip fst_conv length_Cons list.sel(1) zip_Cons_Cons)


[STATEMENT]
lemma independent_explicit_finite_subsets:
  "independent A \<longleftrightarrow> (\<forall>S \<subseteq> A. finite S \<longrightarrow> (\<forall>u. (\<Sum>v\<in>S. u v *s v) = 0 \<longrightarrow> (\<forall>v\<in>S. u v = 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent A = (\<forall>S\<subseteq>A. finite S \<longrightarrow> (\<forall>u. (\<Sum>v\<in>S. u v *s v) = (0::'b) \<longrightarrow> (\<forall>v\<in>S. u v = (0::'a))))
[PROOF STEP]
unfolding dependent_explicit [of A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>t u. finite t \<and> t \<subseteq> A \<and> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<and> (\<exists>v\<in>t. u v \<noteq> (0::'a))) = (\<forall>S\<subseteq>A. finite S \<longrightarrow> (\<forall>u. (\<Sum>v\<in>S. u v *s v) = (0::'b) \<longrightarrow> (\<forall>v\<in>S. u v = (0::'a))))
[PROOF STEP]
by (simp add: disj_not2)


[STATEMENT]
lemma min_mult_left:
  assumes "(x::real) > 0"
  shows   "x * min y z = min (x*y) (x*z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * min y z = min (x * y) (x * z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. x * min y z = min (x * y) (x * z)
[PROOF STEP]
by (auto simp add: min_def algebra_simps)


[STATEMENT]
lemma wf_less_multiset: "wf {(M :: 'a multiset, N). M < N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(M, N). M < N}
[PROOF STEP]
unfolding less_multiset_def multp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(M, N). (M, N) \<in> mult {(x, y). x < y}}
[PROOF STEP]
by (auto intro: wf_mult wf)


[STATEMENT]
theorem prime:
  assumes odd_prime: "prime n"
  shows   "primality_test P n = return_pmf True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
have "set_pmf (primality_test P n) \<subseteq> {True, False}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_pmf (primality_test P n) \<subseteq> {True, False}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_pmf (primality_test P n) \<subseteq> {True, False}

goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_pmf (primality_test P n) \<subseteq> {True, False}

goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime n
[PROOF STEP]
have "False \<notin> set_pmf (primality_test P n)"
[PROOF STATE]
proof (prove)
using this:
prime n

goal (1 subgoal):
 1. False \<notin> set_pmf (primality_test P n)
[PROOF STEP]
using FalseD
[PROOF STATE]
proof (prove)
using this:
prime n
False \<in> set_pmf (primality_test P n) \<Longrightarrow> \<not> prime n

goal (1 subgoal):
 1. False \<notin> set_pmf (primality_test P n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False \<notin> set_pmf (primality_test P n)

goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_pmf (primality_test P n) \<subseteq> {True, False}
False \<notin> set_pmf (primality_test P n)
[PROOF STEP]
have "set_pmf (primality_test P n) \<subseteq> {True}"
[PROOF STATE]
proof (prove)
using this:
set_pmf (primality_test P n) \<subseteq> {True, False}
False \<notin> set_pmf (primality_test P n)

goal (1 subgoal):
 1. set_pmf (primality_test P n) \<subseteq> {True}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_pmf (primality_test P n) \<subseteq> {True}

goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set_pmf (primality_test P n) \<subseteq> {True}

goal (1 subgoal):
 1. primality_test P n = return_pmf True
[PROOF STEP]
by (subst (asm) set_pmf_subset_singleton)
[PROOF STATE]
proof (state)
this:
primality_test P n = return_pmf True

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nodes_mono: "mono nodes"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono nodes
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
fix A B :: "('label, 'state) nba"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
assume 1: "A \<le> B"
[PROOF STATE]
proof (state)
this:
A \<le> B

goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
have 2: "alphabet A \<subseteq> alphabet B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. alphabet A \<subseteq> alphabet B
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
A \<le> B

goal (1 subgoal):
 1. alphabet A \<subseteq> alphabet B
[PROOF STEP]
unfolding less_eq_nba_def
[PROOF STATE]
proof (prove)
using this:
alphabet A \<subseteq> alphabet B \<and> initial A \<subseteq> initial B \<and> transition A \<le> transition B \<and> accepting A \<le> accepting B

goal (1 subgoal):
 1. alphabet A \<subseteq> alphabet B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
alphabet A \<subseteq> alphabet B

goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
have 3: "initial A \<subseteq> initial B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. initial A \<subseteq> initial B
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
A \<le> B

goal (1 subgoal):
 1. initial A \<subseteq> initial B
[PROOF STEP]
unfolding less_eq_nba_def
[PROOF STATE]
proof (prove)
using this:
alphabet A \<subseteq> alphabet B \<and> initial A \<subseteq> initial B \<and> transition A \<le> transition B \<and> accepting A \<le> accepting B

goal (1 subgoal):
 1. initial A \<subseteq> initial B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
initial A \<subseteq> initial B

goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
have 4: "transition A a p \<subseteq> transition B a p" for a p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transition A a p \<subseteq> transition B a p
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
A \<le> B

goal (1 subgoal):
 1. transition A a p \<subseteq> transition B a p
[PROOF STEP]
unfolding less_eq_nba_def le_fun_def
[PROOF STATE]
proof (prove)
using this:
alphabet A \<subseteq> alphabet B \<and> initial A \<subseteq> initial B \<and> (\<forall>x xa. transition A x xa \<subseteq> transition B x xa) \<and> (\<forall>x. accepting A x \<le> accepting B x)

goal (1 subgoal):
 1. transition A a p \<subseteq> transition B a p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
transition A ?a ?p \<subseteq> transition B ?a ?p

goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
have 5: "p \<in> nodes B" if "p \<in> nodes A" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> nodes B
[PROOF STEP]
using that 2 3 4
[PROOF STATE]
proof (prove)
using this:
p \<in> nodes A
alphabet A \<subseteq> alphabet B
initial A \<subseteq> initial B
transition A ?a ?p \<subseteq> transition B ?a ?p

goal (1 subgoal):
 1. p \<in> nodes B
[PROOF STEP]
by induct fastforce+
[PROOF STATE]
proof (state)
this:
?p \<in> nodes A \<Longrightarrow> ?p \<in> nodes B

goal (1 subgoal):
 1. \<And>x y. x \<le> y \<Longrightarrow> nodes x \<subseteq> nodes y
[PROOF STEP]
show "nodes A \<subseteq> nodes B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes A \<subseteq> nodes B
[PROOF STEP]
using 5
[PROOF STATE]
proof (prove)
using this:
?p \<in> nodes A \<Longrightarrow> ?p \<in> nodes B

goal (1 subgoal):
 1. nodes A \<subseteq> nodes B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nodes A \<subseteq> nodes B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem approx_slp_range_tms:
  assumes "approx_slp p ord d slp VS = Some X"
  assumes slp_def: "slp = slp_of_fas fas"
  assumes d_def: "d = length fas"
  assumes e: "e \<in> UNIV \<rightarrow> {-1 .. 1}"
  assumes vs: "vs all_in\<^sub>i range_tms e VS"
  assumes lens: "\<And>tm. tm \<in> set VS \<Longrightarrow> num_params (tm_poly tm) \<le> length vs"
  shows "interpret_floatariths fas vs all_in\<^sub>i range_tms e X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
have "interpret_floatariths fas vs = take d (interpret_slp slp vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interpret_floatariths fas vs = take d (interpret_slp slp vs)
[PROOF STEP]
by (simp add: slp_of_fas slp_def d_def)
[PROOF STATE]
proof (state)
this:
interpret_floatariths fas vs = take d (interpret_slp slp vs)

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
interpret_floatariths fas vs = take d (interpret_slp slp vs)

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
have lvs: "length vs = length VS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length vs = length VS
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
local.approx_slp p ord d slp VS = Some X
slp = slp_of_fas fas
d = length fas
e \<in> UNIV \<rightarrow> {- 1..1}
vs all_in\<^sub>i range_tms e VS
?tm \<in> set VS \<Longrightarrow> num_params (tm_poly ?tm) \<le> length vs

goal (1 subgoal):
 1. length vs = length VS
[PROOF STEP]
by (auto simp: all_in_i_def)
[PROOF STATE]
proof (state)
this:
length vs = length VS

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
define i where "i = replicate (length vs) (0::float interval)"
[PROOF STATE]
proof (state)
this:
i = replicate (length vs) 0

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
define I where "I = replicate (length vs) (Ivl (-1) 1::float interval)"
[PROOF STATE]
proof (state)
this:
I = replicate (length vs) (Ivl (- 1) 1)

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
local.approx_slp p ord d slp VS = Some X
slp = slp_of_fas fas
d = length fas
e \<in> UNIV \<rightarrow> {- 1..1}
vs all_in\<^sub>i range_tms e VS
?tm \<in> set VS \<Longrightarrow> num_params (tm_poly ?tm) \<le> length vs
[PROOF STEP]
obtain XS where
    XS: "approx_slp' p ord I i slp VS = Some XS"
    and X: "take d XS = X"
[PROOF STATE]
proof (prove)
using this:
local.approx_slp p ord d slp VS = Some X
slp = slp_of_fas fas
d = length fas
e \<in> UNIV \<rightarrow> {- 1..1}
vs all_in\<^sub>i range_tms e VS
?tm \<in> set VS \<Longrightarrow> num_params (tm_poly ?tm) \<le> length vs

goal (1 subgoal):
 1. (\<And>XS. \<lbrakk>approx_slp' p ord I i slp VS = Some XS; take d XS = X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: approx_slp_def lvs i_def I_def)
[PROOF STATE]
proof (state)
this:
approx_slp' p ord I i slp VS = Some XS
take d XS = X

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
have iI: "i all_subset I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i all_subset I
[PROOF STEP]
by (auto simp: i_def I_def set_of_Ivl)
[PROOF STATE]
proof (state)
this:
i all_subset I

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
have dev: "develops_at_within e i I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. develops_at_within e i I
[PROOF STEP]
using e
[PROOF STATE]
proof (prove)
using this:
e \<in> UNIV \<rightarrow> {- 1..1}

goal (1 subgoal):
 1. develops_at_within e i I
[PROOF STEP]
by (auto simp: develops_at_within_def i_def I_def set_of_Ivl real_interval_Ivl
        real_interval_minus real_interval_zero set_of_eq Pi_iff min_def)
[PROOF STATE]
proof (state)
this:
develops_at_within e i I

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
from approx_slp'_range[OF iI dev vs _ XS] lens
[PROOF STATE]
proof (chain)
picking this:
(\<And>tm. tm \<in> set VS \<Longrightarrow> num_params (tm_poly tm) \<le> length I) \<Longrightarrow> interpret_slp slp vs all_in\<^sub>i range_tms e XS
?tm \<in> set VS \<Longrightarrow> num_params (tm_poly ?tm) \<le> length vs
[PROOF STEP]
have "interpret_slp slp vs all_in\<^sub>i range_tms e XS"
[PROOF STATE]
proof (prove)
using this:
(\<And>tm. tm \<in> set VS \<Longrightarrow> num_params (tm_poly tm) \<le> length I) \<Longrightarrow> interpret_slp slp vs all_in\<^sub>i range_tms e XS
?tm \<in> set VS \<Longrightarrow> num_params (tm_poly ?tm) \<le> length vs

goal (1 subgoal):
 1. interpret_slp slp vs all_in\<^sub>i range_tms e XS
[PROOF STEP]
by (auto simp: I_def)
[PROOF STATE]
proof (state)
this:
interpret_slp slp vs all_in\<^sub>i range_tms e XS

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
interpret_slp slp vs all_in\<^sub>i range_tms e XS
[PROOF STEP]
have "take d (interpret_slp slp vs) all_in\<^sub>i range_tms e (take d XS)"
[PROOF STATE]
proof (prove)
using this:
interpret_slp slp vs all_in\<^sub>i range_tms e XS

goal (1 subgoal):
 1. take d (interpret_slp slp vs) all_in\<^sub>i range_tms e (take d XS)
[PROOF STEP]
by (auto simp: all_in_i_def range_tms_def)
[PROOF STATE]
proof (state)
this:
take d (interpret_slp slp vs) all_in\<^sub>i range_tms e (take d XS)

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
take d (interpret_slp slp vs) all_in\<^sub>i range_tms e (take d XS)

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
note \<open>take d XS = X\<close>
[PROOF STATE]
proof (state)
this:
take d XS = X

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
interpret_floatariths fas vs all_in\<^sub>i range_tms e X

goal (1 subgoal):
 1. interpret_floatariths fas vs all_in\<^sub>i range_tms e X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
interpret_floatariths fas vs all_in\<^sub>i range_tms e X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Bseq_iff1a: "Bseq X \<longleftrightarrow> (\<exists>N. \<forall>n. norm (X n) < real (Suc N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq X = (\<exists>N. \<forall>n. norm (X n) < real (Suc N))
[PROOF STEP]
by (simp add: Bseq_def lemma_NBseq_def2)


[STATEMENT]
lemma matrix_to_iarray_third_Gauss_Jordan_column_k_PA:
assumes i: "i\<le>nrows A" and k: "k<ncols A"
shows "matrix_to_iarray (snd (snd (Gauss_Jordan_column_k_PA (P,i,A) k))) = snd (snd (Gauss_Jordan_column_k_iarrays_PA (matrix_to_iarray P, i, matrix_to_iarray A) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (snd (snd (Gauss_Jordan_column_k_PA (P, i, A) k))) = snd (snd (Gauss_Jordan_column_k_iarrays_PA (matrix_to_iarray P, i, matrix_to_iarray A) k))
[PROOF STEP]
using matrix_to_iarray_Gauss_Jordan_column_k_2[OF k i]
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (Gauss_Jordan_column_k (i, A) k)) = snd (Gauss_Jordan_column_k_iarrays (i, matrix_to_iarray A) k)

goal (1 subgoal):
 1. matrix_to_iarray (snd (snd (Gauss_Jordan_column_k_PA (P, i, A) k))) = snd (snd (Gauss_Jordan_column_k_iarrays_PA (matrix_to_iarray P, i, matrix_to_iarray A) k))
[PROOF STEP]
unfolding Gauss_Jordan_column_k_def Gauss_Jordan_column_k_iarrays_def
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (let ia = fst (i, A); A = snd (i, A); from_nat_i = mod_type_class.from_nat ia; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> ia = nrows A then (ia, A) else (ia + 1, Gauss_Jordan_in_ij A from_nat_i from_nat_k))) = snd (let Aa = snd (i, matrix_to_iarray A); i = fst (i, matrix_to_iarray A) in if vector_all_zero_from_index (i, column_iarray k Aa) \<or> i = nrows_iarray Aa then (i, Aa) else (Suc i, Gauss_Jordan_in_ij_iarrays Aa i k))

goal (1 subgoal):
 1. matrix_to_iarray (snd (snd (Gauss_Jordan_column_k_PA (P, i, A) k))) = snd (snd (Gauss_Jordan_column_k_iarrays_PA (matrix_to_iarray P, i, matrix_to_iarray A) k))
[PROOF STEP]
unfolding Gauss_Jordan_column_k_PA_def Gauss_Jordan_column_k_iarrays_PA_def snd_conv fst_conv Let_def
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (i, A) else (i + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) = snd (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then (i, matrix_to_iarray A) else (Suc i, Gauss_Jordan_in_ij_iarrays (matrix_to_iarray A) i k))

goal (1 subgoal):
 1. matrix_to_iarray (snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))))) = snd (snd (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then (matrix_to_iarray P, i, matrix_to_iarray A) else (fst (Gauss_Jordan_in_ij_iarrays_PA (matrix_to_iarray P, matrix_to_iarray A) i k), i + 1, snd (Gauss_Jordan_in_ij_iarrays_PA (matrix_to_iarray P, matrix_to_iarray A) i k))))
[PROOF STEP]
unfolding snd_Gauss_Jordan_in_ij_iarrays_PA
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (i, A) else (i + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) = snd (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then (i, matrix_to_iarray A) else (Suc i, Gauss_Jordan_in_ij_iarrays (matrix_to_iarray A) i k))

goal (1 subgoal):
 1. matrix_to_iarray (snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))))) = snd (snd (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then (matrix_to_iarray P, i, matrix_to_iarray A) else (fst (Gauss_Jordan_in_ij_iarrays_PA (matrix_to_iarray P, matrix_to_iarray A) i k), i + 1, Gauss_Jordan_in_ij_iarrays (matrix_to_iarray A) i k)))
[PROOF STEP]
unfolding snd_if_conv snd_Gauss_Jordan_in_ij_PA_eq
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then A else Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)) = (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then matrix_to_iarray A else Gauss_Jordan_in_ij_iarrays (matrix_to_iarray A) i k)

goal (1 subgoal):
 1. matrix_to_iarray (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then A else Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)) = (if vector_all_zero_from_index (i, column_iarray k (matrix_to_iarray A)) \<or> i = nrows_iarray (matrix_to_iarray A) then matrix_to_iarray A else Gauss_Jordan_in_ij_iarrays (matrix_to_iarray A) i k)
[PROOF STEP]
by fast


[STATEMENT]
lemma stirling_same [simp]: "stirling n n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling n n = 1
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma last_in_list_set:  "length xs \<ge> 1 \<Longrightarrow> last xs \<in> set (xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> length xs \<Longrightarrow> last xs \<in> set xs
[PROOF STEP]
using dual_order.strict_trans1 last_in_set
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b \<le> ?a; ?c < ?b\<rbrakk> \<Longrightarrow> ?c < ?a
?as \<noteq> [] \<Longrightarrow> last ?as \<in> set ?as

goal (1 subgoal):
 1. 1 \<le> length xs \<Longrightarrow> last xs \<in> set xs
[PROOF STEP]
by blast


[STATEMENT]
lemma OKI_inj[simp]:
fixes inp inp' :: "('index,'gTerm)input"
shows "(OKI inp = OKI inp') = (inp = inp')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (OKI inp = OKI inp') = (inp = inp')
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OKI inp = OKI inp' \<Longrightarrow> inp = inp'
[PROOF STEP]
unfolding OKI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift OK inp = lift OK inp' \<Longrightarrow> inp = inp'
[PROOF STEP]
using lift_preserves_inj[of OK]
[PROOF STATE]
proof (prove)
using this:
inj OK \<Longrightarrow> inj (lift OK)

goal (1 subgoal):
 1. lift OK inp = lift OK inp' \<Longrightarrow> inp = inp'
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. OK x = OK y \<longrightarrow> x = y \<Longrightarrow> \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. lift OK x = lift OK y \<longrightarrow> x = y

goal (1 subgoal):
 1. lift OK inp = lift OK inp' \<Longrightarrow> inp = inp'
[PROOF STEP]
by auto


[STATEMENT]
lemma length_zip_with [simp]: "length (zip_with f xs ys) = min (length xs) (length ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (zip_with f xs ys) = min (length xs) (length ys)
[PROOF STEP]
by (induction f xs ys rule: zip_with.induct) simp_all


[STATEMENT]
lemma DERIV_cong_ev:
  "x = y \<Longrightarrow> eventually (\<lambda>x. f x = g x) (nhds x) \<Longrightarrow> u = v \<Longrightarrow>
    DERIV f x :> u \<longleftrightarrow> DERIV g y :> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = y; \<forall>\<^sub>F x in nhds x. f x = g x; u = v\<rbrakk> \<Longrightarrow> (f has_field_derivative u) (at x) = (g has_field_derivative v) (at y)
[PROOF STEP]
by (rule has_field_derivative_cong_ev) simp_all


[STATEMENT]
lemma inter_comm: "inter l m = inter m l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.inter l m = local.inter m l
[PROOF STEP]
by (simp add: inter_def inters_comm)


[STATEMENT]
lemma iso_point_in_block_img_iff: "p \<in> \<V> \<Longrightarrow> bl \<in># \<B> \<Longrightarrow> p \<in> bl \<longleftrightarrow> (\<pi> p) \<in> (\<pi> ` bl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> \<V>; bl \<in># \<B>\<rbrakk> \<Longrightarrow> (p \<in> bl) = (\<pi> p \<in> \<pi> ` bl)
[PROOF STEP]
by (metis bij bij_betw_imp_surj_on iso_bij_betw_individual_blocks_inv bij_betw_inv_into_left imageI)


[STATEMENT]
lemma total_on_lexord_less_than_char_linear2:
  \<open>xs \<noteq> ys \<Longrightarrow> (xs, ys) \<notin> lexord (less_than_char) \<longleftrightarrow>
       (ys, xs) \<in> lexord less_than_char\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> ys \<Longrightarrow> ((xs, ys) \<notin> lexord less_than_char) = ((ys, xs) \<in> lexord less_than_char)
[PROOF STEP]
using lexord_linear[of \<open>less_than_char\<close> xs ys]
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. (a, b) \<in> less_than_char \<or> a = b \<or> (b, a) \<in> less_than_char \<Longrightarrow> (xs, ys) \<in> lexord less_than_char \<or> xs = ys \<or> (ys, xs) \<in> lexord less_than_char

goal (1 subgoal):
 1. xs \<noteq> ys \<Longrightarrow> ((xs, ys) \<notin> lexord less_than_char) = ((ys, xs) \<in> lexord less_than_char)
[PROOF STEP]
using lexord_linear[of \<open>less_than_char\<close>] less_than_char_linear
[PROOF STATE]
proof (prove)
using this:
\<forall>a b. (a, b) \<in> less_than_char \<or> a = b \<or> (b, a) \<in> less_than_char \<Longrightarrow> (xs, ys) \<in> lexord less_than_char \<or> xs = ys \<or> (ys, xs) \<in> lexord less_than_char
\<forall>a b. (a, b) \<in> less_than_char \<or> a = b \<or> (b, a) \<in> less_than_char \<Longrightarrow> (?x, ?y) \<in> lexord less_than_char \<or> ?x = ?y \<or> (?y, ?x) \<in> lexord less_than_char
(?a, ?b) \<in> less_than_char \<or> ?a = ?b \<or> (?b, ?a) \<in> less_than_char

goal (1 subgoal):
 1. xs \<noteq> ys \<Longrightarrow> ((xs, ys) \<notin> lexord less_than_char) = ((ys, xs) \<in> lexord less_than_char)
[PROOF STEP]
apply (auto simp: Relation.total_on_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>xs \<noteq> ys; \<And>x y. (x, y) \<in> lexord (p2rel (<)) \<or> x = y \<or> (y, x) \<in> lexord (p2rel (<)); \<And>a b. (a, b) \<in> p2rel (<) \<or> a = b \<or> (b, a) \<in> p2rel (<); (ys, xs) \<in> lexord (p2rel (<)); (xs, ys) \<in> lexord (p2rel (<))\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>xs \<noteq> ys; \<And>x y. (x, y) \<in> lexord (p2rel (<)) \<or> x = y \<or> (y, x) \<in> lexord (p2rel (<)); \<And>a b. (a, b) \<in> p2rel (<) \<or> a = b \<or> (b, a) \<in> p2rel (<); (ys, xs) \<in> lexord (p2rel (<)); (xs, ys) \<in> lexord (p2rel (<))\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using lexord_irrefl[OF irrefl_less_than_char]
     antisym_lexord[OF antisym_less_than_char irrefl_less_than_char]
[PROOF STATE]
proof (prove)
using this:
irrefl (lexord less_than_char)
antisym (lexord less_than_char)

goal (2 subgoals):
 1. \<lbrakk>xs \<noteq> ys; \<And>x y. (x, y) \<in> lexord (p2rel (<)) \<or> x = y \<or> (y, x) \<in> lexord (p2rel (<)); \<And>a b. (a, b) \<in> p2rel (<) \<or> a = b \<or> (b, a) \<in> p2rel (<); (ys, xs) \<in> lexord (p2rel (<)); (xs, ys) \<in> lexord (p2rel (<))\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>xs \<noteq> ys; \<And>x y. (x, y) \<in> lexord (p2rel (<)) \<or> x = y \<or> (y, x) \<in> lexord (p2rel (<)); \<And>a b. (a, b) \<in> p2rel (<) \<or> a = b \<or> (b, a) \<in> p2rel (<); (ys, xs) \<in> lexord (p2rel (<)); (xs, ys) \<in> lexord (p2rel (<))\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (auto simp: antisym_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done