[STATEMENT]
lemma estimate'_bounds:
  "prob {\<omega>. of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - of_rat (F 0 as)\<bar>} \<le> 1/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
proof (cases "card (set as) \<ge> t")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
t \<le> card (set as)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
define \<delta>' where "\<delta>' = 3 * real_of_rat \<delta> / 4"
[PROOF STATE]
proof (state)
this:
\<delta>' = 3 * real_of_rat \<delta> / 4

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
define u where "u = \<lceil>real t * p / (m * (1+\<delta>'))\<rceil>"
[PROOF STATE]
proof (state)
this:
u = \<lceil>real t * real p / (real m * (1 + \<delta>'))\<rceil>

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
define v where "v = \<lfloor>real t * p / (m * (1-\<delta>'))\<rfloor>"
[PROOF STATE]
proof (state)
this:
v = \<lfloor>real t * real p / (real m * (1 - \<delta>'))\<rfloor>

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
define has_no_collision where
    "has_no_collision = (\<lambda>\<omega>. \<forall>x\<in> set as. \<forall>y \<in> set as. (tr_hash x \<omega> = tr_hash y \<omega> \<longrightarrow> x = y) \<or> tr_hash x \<omega> > v)"
[PROOF STATE]
proof (state)
this:
has_no_collision = (\<lambda>\<omega>. \<forall>x\<in>set as. \<forall>y\<in>set as. (tr_hash x \<omega> = tr_hash y \<omega> \<longrightarrow> x = y) \<or> real_of_int v < tr_hash x \<omega>)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "2 powr (-real r) \<le> 2 powr (-(4 * log 2 (1 / real_of_rat \<delta>) + 23))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr - real r \<le> 2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23)
[PROOF STEP]
using r_bound
[PROOF STATE]
proof (prove)
using this:
4 * log 2 (1 / real_of_rat \<delta>) + 23 \<le> real r

goal (1 subgoal):
 1. 2 powr - real r \<le> 2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23)
[PROOF STEP]
by (intro powr_mono, linarith, simp)
[PROOF STATE]
proof (state)
this:
2 powr - real r \<le> 2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr - real r \<le> 2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = 2 powr (-4 * log 2 (1 /real_of_rat \<delta>) -23)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23) = 2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23)
[PROOF STEP]
by (rule arg_cong2[where f="(powr)"], auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23) = 2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr - (4 * log 2 (1 / real_of_rat \<delta>) + 23) = 2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 2 powr ( -1 * log 2 (1 /real_of_rat \<delta>) -4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23) \<le> 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4)
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. 2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23) \<le> 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4)
[PROOF STEP]
by (intro powr_mono diff_mono, auto)
[PROOF STATE]
proof (state)
this:
2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23) \<le> 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (- 4 * log 2 (1 / real_of_rat \<delta>) - 23) \<le> 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = 2 powr ( -1 * log 2 (1 /real_of_rat \<delta>)) /  16"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4) = 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16
[PROOF STEP]
by (simp add: powr_diff)
[PROOF STATE]
proof (state)
this:
2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4) = 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (- 1 * log 2 (1 / real_of_rat \<delta>) - 4) = 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = real_of_rat \<delta> / 16"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16 = real_of_rat \<delta> / 16
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. 2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16 = real_of_rat \<delta> / 16
[PROOF STEP]
by (simp add:log_divide)
[PROOF STATE]
proof (state)
this:
2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16 = real_of_rat \<delta> / 16

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (- 1 * log 2 (1 / real_of_rat \<delta>)) / 16 = real_of_rat \<delta> / 16

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... < real_of_rat \<delta> / 8"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat \<delta> / 16 < real_of_rat \<delta> / 8
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. real_of_rat \<delta> / 16 < real_of_rat \<delta> / 8
[PROOF STEP]
by (subst pos_divide_less_eq, auto)
[PROOF STATE]
proof (state)
this:
real_of_rat \<delta> / 16 < real_of_rat \<delta> / 8

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 powr - real r < real_of_rat \<delta> / 8
[PROOF STEP]
have r_le_\<delta>: "2 powr (-real r) < real_of_rat \<delta> / 8"
[PROOF STATE]
proof (prove)
using this:
2 powr - real r < real_of_rat \<delta> / 8

goal (1 subgoal):
 1. 2 powr - real r < real_of_rat \<delta> / 8
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 powr - real r < real_of_rat \<delta> / 8

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have \<delta>'_gt_0: "\<delta>' > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<delta>'
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. 0 < \<delta>'
[PROOF STEP]
by (simp add:\<delta>'_def)
[PROOF STATE]
proof (state)
this:
0 < \<delta>'

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "\<delta>' < 3/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<delta>' < 3 / 4
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. \<delta>' < 3 / 4
[PROOF STEP]
by (simp add:\<delta>'_def)+
[PROOF STATE]
proof (state)
this:
\<delta>' < 3 / 4

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<delta>' < 3 / 4

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 / 4 < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
3 / 4 < 1

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<delta>' < 1
[PROOF STEP]
have \<delta>'_lt_1: "\<delta>' < 1"
[PROOF STATE]
proof (prove)
using this:
\<delta>' < 1

goal (1 subgoal):
 1. \<delta>' < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<delta>' < 1

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "t \<le> 81 / (real_of_rat \<delta>)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t \<le> 81 / (real_of_rat \<delta>)\<^sup>2
[PROOF STEP]
using t_bound
[PROOF STATE]
proof (prove)
using this:
real t \<le> 81 / (real_of_rat \<delta>)\<^sup>2

goal (1 subgoal):
 1. real t \<le> 81 / (real_of_rat \<delta>)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t \<le> 81 / (real_of_rat \<delta>)\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t \<le> 81 / (real_of_rat \<delta>)\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = (81*9/16) / (\<delta>')\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 81 / (real_of_rat \<delta>)\<^sup>2 = 81 * 9 / 16 / \<delta>'\<^sup>2
[PROOF STEP]
by (simp add:\<delta>'_def power2_eq_square)
[PROOF STATE]
proof (state)
this:
81 / (real_of_rat \<delta>)\<^sup>2 = 81 * 9 / 16 / \<delta>'\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
81 / (real_of_rat \<delta>)\<^sup>2 = 81 * 9 / 16 / \<delta>'\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 46 / \<delta>'\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 81 * 9 / 16 / \<delta>'\<^sup>2 \<le> 46 / \<delta>'\<^sup>2
[PROOF STEP]
by (intro divide_right_mono, simp, simp)
[PROOF STATE]
proof (state)
this:
81 * 9 / 16 / \<delta>'\<^sup>2 \<le> 46 / \<delta>'\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real t \<le> 46 / \<delta>'\<^sup>2
[PROOF STEP]
have t_le_\<delta>': "t \<le> 46/ \<delta>'\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
real t \<le> 46 / \<delta>'\<^sup>2

goal (1 subgoal):
 1. real t \<le> 46 / \<delta>'\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t \<le> 46 / \<delta>'\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "80 \<le> (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 80 \<le> (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2)
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. 80 \<le> (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (real_of_rat \<delta>)\<^sup>2 * t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2) \<le> (real_of_rat \<delta>)\<^sup>2 * real t
[PROOF STEP]
by (intro mult_left_mono, simp add:t_def of_nat_ceiling, simp)
[PROOF STATE]
proof (state)
this:
(real_of_rat \<delta>)\<^sup>2 * (80 / (real_of_rat \<delta>)\<^sup>2) \<le> (real_of_rat \<delta>)\<^sup>2 * real t

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * real t
[PROOF STEP]
have "80 \<le> (real_of_rat \<delta>)\<^sup>2 * t"
[PROOF STATE]
proof (prove)
using this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * real t

goal (1 subgoal):
 1. 80 \<le> (real_of_rat \<delta>)\<^sup>2 * real t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * real t

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence t_ge_\<delta>': "45 \<le> t * \<delta>' * \<delta>'"
[PROOF STATE]
proof (prove)
using this:
80 \<le> (real_of_rat \<delta>)\<^sup>2 * real t

goal (1 subgoal):
 1. 45 \<le> real t * \<delta>' * \<delta>'
[PROOF STEP]
by (simp add:\<delta>'_def power2_eq_square)
[PROOF STATE]
proof (state)
this:
45 \<le> real t * \<delta>' * \<delta>'

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "m \<le> card {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> card {..<n}
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set as) \<le> card {..<n}
[PROOF STEP]
using as_range
[PROOF STATE]
proof (prove)
using this:
set as \<subseteq> {..<n}

goal (1 subgoal):
 1. card (set as) \<le> card {..<n}
[PROOF STEP]
by (intro card_mono, auto)
[PROOF STATE]
proof (state)
this:
m \<le> card {..<n}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m \<le> card {..<n}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {..<n} \<le> p
[PROOF STEP]
using n_le_p
[PROOF STATE]
proof (prove)
using this:
n \<le> p

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
m \<le> p
[PROOF STEP]
have m_le_p: "m \<le> p"
[PROOF STATE]
proof (prove)
using this:
m \<le> p

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence t_le_m: "t \<le> card (set as)"
[PROOF STATE]
proof (prove)
using this:
m \<le> p

goal (1 subgoal):
 1. t \<le> card (set as)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
m \<le> p
t \<le> card (set as)

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have m_ge_0: "real m > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real m
[PROOF STEP]
using m_def True t_gt_0
[PROOF STATE]
proof (prove)
using this:
m = card (set as)
t \<le> card (set as)
0 < t

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "v \<le> real t * real p / (real m * (1 - \<delta>'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int v \<le> real t * real p / (real m * (1 - \<delta>'))
[PROOF STEP]
by (simp add:v_def)
[PROOF STATE]
proof (state)
this:
real_of_int v \<le> real t * real p / (real m * (1 - \<delta>'))

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int v \<le> real t * real p / (real m * (1 - \<delta>'))

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> real t * real p / (real m * (1/4))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t * real p / (real m * (1 - \<delta>')) \<le> real t * real p / (real m * (1 / 4))
[PROOF STEP]
using \<delta>'_lt_1 m_ge_0 \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta>' < 1
0 < real m
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. real t * real p / (real m * (1 - \<delta>')) \<le> real t * real p / (real m * (1 / 4))
[PROOF STEP]
by (intro divide_left_mono mult_left_mono mult_nonneg_nonneg mult_pos_pos, simp_all add:\<delta>'_def)
[PROOF STATE]
proof (state)
this:
real t * real p / (real m * (1 - \<delta>')) \<le> real t * real p / (real m * (1 / 4))

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int v \<le> real t * real p / (real m * (1 / 4))
[PROOF STEP]
have v_ubound: "v \<le> 4 * real t * real p / real m"
[PROOF STATE]
proof (prove)
using this:
real_of_int v \<le> real t * real p / (real m * (1 / 4))

goal (1 subgoal):
 1. real_of_int v \<le> 4 * real t * real p / real m
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int v \<le> 4 * real t * real p / real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have a_ge_1: "u \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> u
[PROOF STEP]
using \<delta>'_gt_0 p_gt_0 m_ge_0 t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
0 < p
0 < real m
0 < t

goal (1 subgoal):
 1. 1 \<le> u
[PROOF STEP]
by (auto intro!:mult_pos_pos divide_pos_pos simp add:u_def)
[PROOF STATE]
proof (state)
this:
1 \<le> u

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence a_ge_0: "u \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> u

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "real m * (1 - \<delta>') < real m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * (1 - \<delta>') < real m
[PROOF STEP]
using \<delta>'_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
0 < real m

goal (1 subgoal):
 1. real m * (1 - \<delta>') < real m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m * (1 - \<delta>') < real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * (1 - \<delta>') < real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1 * real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m \<le> 1 * real p
[PROOF STEP]
using m_le_p
[PROOF STATE]
proof (prove)
using this:
m \<le> p

goal (1 subgoal):
 1. real m \<le> 1 * real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m \<le> 1 * real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m \<le> 1 * real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> real t * real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * real p \<le> real t * real p
[PROOF STEP]
using t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < t

goal (1 subgoal):
 1. 1 * real p \<le> real t * real p
[PROOF STEP]
by (intro mult_right_mono, auto)
[PROOF STATE]
proof (state)
this:
1 * real p \<le> real t * real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real m * (1 - \<delta>') < real t * real p
[PROOF STEP]
have " real m * (1 - \<delta>') < real t * real p"
[PROOF STATE]
proof (prove)
using this:
real m * (1 - \<delta>') < real t * real p

goal (1 subgoal):
 1. real m * (1 - \<delta>') < real t * real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m * (1 - \<delta>') < real t * real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence v_gt_0: "v > 0"
[PROOF STATE]
proof (prove)
using this:
real m * (1 - \<delta>') < real t * real p

goal (1 subgoal):
 1. 0 < v
[PROOF STEP]
using mult_pos_pos m_ge_0 \<delta>'_lt_1
[PROOF STATE]
proof (prove)
using this:
real m * (1 - \<delta>') < real t * real p
\<lbrakk>(0::?'a) < ?a; (0::?'a) < ?b\<rbrakk> \<Longrightarrow> (0::?'a) < ?a * ?b
0 < real m
\<delta>' < 1

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence v_ge_1: "real_of_int v \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
0 < v

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "real t \<le> real m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t \<le> real m
[PROOF STEP]
using True m_def
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
m = card (set as)

goal (1 subgoal):
 1. real t \<le> real m
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real t \<le> real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t \<le> real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... < (1 + \<delta>') * real m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m < (1 + \<delta>') * real m
[PROOF STEP]
using \<delta>'_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
0 < real m

goal (1 subgoal):
 1. real m < (1 + \<delta>') * real m
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
real m < (1 + \<delta>') * real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real t < (1 + \<delta>') * real m
[PROOF STEP]
have a_le_p_aux: "real t < (1 + \<delta>') * real m"
[PROOF STATE]
proof (prove)
using this:
real t < (1 + \<delta>') * real m

goal (1 subgoal):
 1. real t < (1 + \<delta>') * real m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t < (1 + \<delta>') * real m

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "u \<le> real t * real p / (real m * (1 + \<delta>'))+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int u \<le> real t * real p / (real m * (1 + \<delta>')) + 1
[PROOF STEP]
by (simp add:u_def)
[PROOF STATE]
proof (state)
this:
real_of_int u \<le> real t * real p / (real m * (1 + \<delta>')) + 1

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int u \<le> real t * real p / (real m * (1 + \<delta>')) + 1

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... < real p + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t * real p / (real m * (1 + \<delta>')) + 1 < real p + 1
[PROOF STEP]
using m_ge_0 \<delta>'_gt_0 a_le_p_aux  a_le_p_aux p_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < real m
0 < \<delta>'
real t < (1 + \<delta>') * real m
real t < (1 + \<delta>') * real m
0 < p

goal (1 subgoal):
 1. real t * real p / (real m * (1 + \<delta>')) + 1 < real p + 1
[PROOF STEP]
by (simp add: pos_divide_less_eq ac_simps)
[PROOF STATE]
proof (state)
this:
real t * real p / (real m * (1 + \<delta>')) + 1 < real p + 1

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int u < real p + 1
[PROOF STEP]
have "u \<le> real p"
[PROOF STATE]
proof (prove)
using this:
real_of_int u < real p + 1

goal (1 subgoal):
 1. real_of_int u \<le> real p
[PROOF STEP]
by (metis int_less_real_le not_less of_int_le_iff of_int_of_nat_eq)
[PROOF STATE]
proof (state)
this:
real_of_int u \<le> real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
hence u_le_p: "u \<le> int p"
[PROOF STATE]
proof (prove)
using this:
real_of_int u \<le> real p

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

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "prob {\<omega>. Q u \<omega> \<ge> t} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. abs (real (Q u \<omega>) -
    expectation (\<lambda>\<omega>. real (Q u \<omega>))) \<ge> 3 * sqrt (m * real_of_int u / p)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. t \<le> Q u \<omega>} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
proof (rule pmf_mono[OF M_def])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
assume "\<omega> \<in> {\<omega>. t \<le> Q u \<omega>}"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. t \<le> Q u \<omega>}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
hence t_le: "t \<le> Q u \<omega>"
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> {\<omega>. t \<le> Q u \<omega>}

goal (1 subgoal):
 1. t \<le> Q u \<omega>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
t \<le> Q u \<omega>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "real m * real_of_int u / real p \<le> real m * (real t * real p / (real m * (1 + \<delta>'))+1) / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * real_of_int u / real p \<le> real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p
[PROOF STEP]
using m_ge_0 p_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < real m
0 < p

goal (1 subgoal):
 1. real m * real_of_int u / real p \<le> real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p
[PROOF STEP]
by (intro divide_right_mono mult_left_mono, simp_all add: u_def)
[PROOF STATE]
proof (state)
this:
real m * real_of_int u / real p \<le> real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * real_of_int u / real p \<le> real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... = real m * real t * real p / (real m * (1+\<delta>') * real p) + real m / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p = real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p
[PROOF STEP]
by (simp add:distrib_left add_divide_distrib)
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p = real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 + \<delta>')) + 1) / real p = real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... = real t / (1+\<delta>') + real m / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p = real t / (1 + \<delta>') + real m / real p
[PROOF STEP]
using p_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < real m

goal (1 subgoal):
 1. real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p = real t / (1 + \<delta>') + real m / real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p = real t / (1 + \<delta>') + real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * real t * real p / (real m * (1 + \<delta>') * real p) + real m / real p = real t / (1 + \<delta>') + real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real t / (1+\<delta>') + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t / (1 + \<delta>') + real m / real p \<le> real t / (1 + \<delta>') + 1
[PROOF STEP]
using m_le_p p_gt_0
[PROOF STATE]
proof (prove)
using this:
m \<le> p
0 < p

goal (1 subgoal):
 1. real t / (1 + \<delta>') + real m / real p \<le> real t / (1 + \<delta>') + 1
[PROOF STEP]
by (intro add_mono, auto)
[PROOF STATE]
proof (state)
this:
real t / (1 + \<delta>') + real m / real p \<le> real t / (1 + \<delta>') + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1
[PROOF STEP]
have "real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1"
[PROOF STATE]
proof (prove)
using this:
real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1

goal (1 subgoal):
 1. real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
hence "3 * sqrt (real m * of_int u / real p) + real m * of_int u / real p \<le>
      3 * sqrt (t / (1+\<delta>')+1)+(t/(1+\<delta>')+1)"
[PROOF STATE]
proof (prove)
using this:
real m * real_of_int u / real p \<le> real t / (1 + \<delta>') + 1

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> 3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1)
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono, auto)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> 3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> 3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> 3 * sqrt (real t+1) + ((t * (1 - \<delta>' / (1+\<delta>'))) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1) \<le> 3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1)
[PROOF STEP]
using \<delta>'_gt_0 t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
0 < t

goal (1 subgoal):
 1. 3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1) \<le> 3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1)
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono)
        (simp_all add: pos_divide_le_eq left_diff_distrib)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1) \<le> 3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t / (1 + \<delta>') + 1) + (real t / (1 + \<delta>') + 1) \<le> 3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... = 3 * sqrt (real t+1) + (t - \<delta>' * t / (1+\<delta>')) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1) = 3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1) = 3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t + 1) + (real t * (1 - \<delta>' / (1 + \<delta>')) + 1) = 3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (t - \<delta>' * t/2) + 1 / \<delta>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1 \<le> 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>'
[PROOF STEP]
using \<delta>'_gt_0 t_gt_0 \<delta>'_lt_1 add_pos_pos  t_le_\<delta>'
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
0 < t
\<delta>' < 1
\<lbrakk>(0::?'a) < ?a; (0::?'a) < ?b\<rbrakk> \<Longrightarrow> (0::?'a) < ?a + ?b
real t \<le> 46 / \<delta>'\<^sup>2

goal (1 subgoal):
 1. 3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1 \<le> 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>'
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono add_mono)
       (simp_all add: power_le_one pos_le_divide_eq)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1 \<le> 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * sqrt (real t + 1) + (real t - \<delta>' * real t / (1 + \<delta>')) + 1 \<le> 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> (21 / \<delta>' + (t - 45 / (2*\<delta>'))) + 1 / \<delta>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>' \<le> 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>'
[PROOF STEP]
using \<delta>'_gt_0 t_ge_\<delta>'
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
45 \<le> real t * \<delta>' * \<delta>'

goal (1 subgoal):
 1. 3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>' \<le> 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>'
[PROOF STEP]
by (intro add_mono)
         (simp_all add:real_sqrt_divide divide_le_cancel real_le_lsqrt pos_divide_le_eq ac_simps)
[PROOF STATE]
proof (state)
this:
3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>' \<le> 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * sqrt (46 / \<delta>'\<^sup>2 + 1 / \<delta>'\<^sup>2) + (real t - \<delta>' * real t / 2) + 1 / \<delta>' \<le> 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>' \<le> real t
[PROOF STEP]
using \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'

goal (1 subgoal):
 1. 21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>' \<le> real t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>' \<le> real t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
21 / \<delta>' + (real t - 45 / (2 * \<delta>')) + 1 / \<delta>' \<le> real t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> Q u \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t \<le> real (Q u \<omega>)
[PROOF STEP]
using t_le
[PROOF STATE]
proof (prove)
using this:
t \<le> Q u \<omega>

goal (1 subgoal):
 1. real t \<le> real (Q u \<omega>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t \<le> real (Q u \<omega>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)
[PROOF STEP]
have "3 * sqrt (real m * of_int u / real p) + real m * of_int u / real p \<le> Q u \<omega>"
[PROOF STATE]
proof (prove)
using this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
hence " 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>"
[PROOF STATE]
proof (prove)
using this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>
[PROOF STEP]
using a_ge_0 u_le_p  True
[PROOF STATE]
proof (prove)
using this:
3 * sqrt (real m * real_of_int u / real p) + real m * real_of_int u / real p \<le> real (Q u \<omega>)
0 \<le> u
u \<le> int p
t \<le> card (set as)

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>
[PROOF STEP]
by (simp add:exp_Q abs_ge_iff)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. t \<le> Q u \<omega>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
thus "\<omega> \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le>
      \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}"
[PROOF STATE]
proof (prove)
using this:
3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>

goal (1 subgoal):
 1. \<omega> \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}
[PROOF STEP]
by (simp add: M_def)
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. t \<le> Q u \<omega>} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. t \<le> Q u \<omega>} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> variance  (\<lambda>\<omega>. real (Q u \<omega>)) / (3 * sqrt (real m * of_int u / real p))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2
[PROOF STEP]
using a_ge_1 p_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
1 \<le> u
0 < p
0 < real m

goal (1 subgoal):
 1. prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2
[PROOF STEP]
by (intro Chebyshev_inequality, simp add:M_def, auto)
[PROOF STATE]
proof (state)
this:
prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int u / real p) \<le> \<bar>real (Q u \<omega>) - expectation (\<lambda>\<omega>. real (Q u \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (real m * real_of_int u / real p) / (3 * sqrt (real m * of_int u / real p))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2
[PROOF STEP]
using a_ge_0 u_le_p
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
u \<le> int p

goal (1 subgoal):
 1. expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2
[PROOF STEP]
by (intro divide_right_mono var_Q, auto)
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (real (Q u x) - expectation (\<lambda>\<omega>. real (Q u \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1/9"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> 1 / 9
[PROOF STEP]
using a_ge_0
[PROOF STATE]
proof (prove)
using this:
0 \<le> u

goal (1 subgoal):
 1. real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real m * real_of_int u / real p / (3 * sqrt (real m * real_of_int u / real p))\<^sup>2 \<le> 1 / 9

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. t \<le> Q u \<omega>} \<le> 1 / 9
[PROOF STEP]
have case_1: "prob {\<omega>. Q u \<omega> \<ge> t} \<le> 1/9"
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. t \<le> Q u \<omega>} \<le> 1 / 9

goal (1 subgoal):
 1. prob {\<omega>. t \<le> Q u \<omega>} \<le> 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. t \<le> Q u \<omega>} \<le> 1 / 9

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have case_2: "prob {\<omega>. Q v \<omega> < t} \<le> 1/9"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
proof (cases "v \<le> p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
v \<le> int p

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. abs (real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))
      \<ge> 3 * sqrt (m * real_of_int v / p)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
proof (rule pmf_mono[OF M_def])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
assume "\<omega> \<in> set_pmf (pmf_of_set space)"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "(real t + 3 * sqrt (real t / (1 - \<delta>') )) * (1 - \<delta>') = real t - \<delta>' * t + 3 * ((1-\<delta>') * sqrt( real t / (1-\<delta>') ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') = real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>')))
[PROOF STEP]
by (simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') = real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') = real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... = real t - \<delta>' * t + 3 * sqrt (  (1-\<delta>')\<^sup>2 * (real t /  (1-\<delta>')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>')))
[PROOF STEP]
using \<delta>'_lt_1
[PROOF STATE]
proof (prove)
using this:
\<delta>' < 1

goal (1 subgoal):
 1. real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>')))
[PROOF STEP]
by (subst real_sqrt_mult, simp)
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * ((1 - \<delta>') * sqrt (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... = real t - \<delta>' * t + 3 * sqrt ( real t * (1- \<delta>'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>'))
[PROOF STEP]
by (simp add:power2_eq_square distrib_left)
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>'))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * sqrt ((1 - \<delta>')\<^sup>2 * (real t / (1 - \<delta>'))) = real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>'))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real t - 45/ \<delta>' + 3 * sqrt ( real t )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>')) \<le> real t - 45 / \<delta>' + 3 * sqrt (real t)
[PROOF STEP]
using \<delta>'_gt_0 t_ge_\<delta>' \<delta>'_lt_1
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
45 \<le> real t * \<delta>' * \<delta>'
\<delta>' < 1

goal (1 subgoal):
 1. real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>')) \<le> real t - 45 / \<delta>' + 3 * sqrt (real t)
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono)
         (simp_all add:pos_divide_le_eq ac_simps left_diff_distrib power_le_one)
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>')) \<le> real t - 45 / \<delta>' + 3 * sqrt (real t)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - \<delta>' * real t + 3 * sqrt (real t * (1 - \<delta>')) \<le> real t - 45 / \<delta>' + 3 * sqrt (real t)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real t - 45/ \<delta>' + 3 * sqrt ( 46 / \<delta>'\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - 45 / \<delta>' + 3 * sqrt (real t) \<le> real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2)
[PROOF STEP]
using  t_le_\<delta>' \<delta>'_lt_1 \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
real t \<le> 46 / \<delta>'\<^sup>2
\<delta>' < 1
0 < \<delta>'

goal (1 subgoal):
 1. real t - 45 / \<delta>' + 3 * sqrt (real t) \<le> real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2)
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono, simp_all add:pos_divide_le_eq power_le_one)
[PROOF STATE]
proof (state)
this:
real t - 45 / \<delta>' + 3 * sqrt (real t) \<le> real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - 45 / \<delta>' + 3 * sqrt (real t) \<le> real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... = real t + (3 * sqrt(46) - 45)/ \<delta>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2) = real t + (3 * sqrt 46 - 45) / \<delta>'
[PROOF STEP]
using \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'

goal (1 subgoal):
 1. real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2) = real t + (3 * sqrt 46 - 45) / \<delta>'
[PROOF STEP]
by (simp add:real_sqrt_divide diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2) = real t + (3 * sqrt 46 - 45) / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - 45 / \<delta>' + 3 * sqrt (46 / \<delta>'\<^sup>2) = real t + (3 * sqrt 46 - 45) / \<delta>'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t + (3 * sqrt 46 - 45) / \<delta>' \<le> real t
[PROOF STEP]
using \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'

goal (1 subgoal):
 1. real t + (3 * sqrt 46 - 45) / \<delta>' \<le> real t
[PROOF STEP]
by (simp add:pos_divide_le_eq real_le_lsqrt)
[PROOF STATE]
proof (state)
this:
real t + (3 * sqrt 46 - 45) / \<delta>' \<le> real t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t
[PROOF STEP]
have aux: "(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t "
[PROOF STATE]
proof (prove)
using this:
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t

goal (1 subgoal):
 1. (real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
assume "\<omega> \<in> {\<omega>. Q v \<omega> < t}"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. Q v \<omega> < t}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
hence "Q v \<omega> < t"
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> {\<omega>. Q v \<omega> < t}

goal (1 subgoal):
 1. Q v \<omega> < t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Q v \<omega> < t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
hence "real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p)
        \<le> real t - 1 + 3 * sqrt (real m * real_of_int v / real p)"
[PROOF STATE]
proof (prove)
using this:
Q v \<omega> < t

goal (1 subgoal):
 1. real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * real_of_int v / real p)
[PROOF STEP]
using m_le_p p_gt_0
[PROOF STATE]
proof (prove)
using this:
Q v \<omega> < t
m \<le> p
0 < p

goal (1 subgoal):
 1. real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * real_of_int v / real p)
[PROOF STEP]
by (intro add_mono, auto simp add: algebra_simps add_divide_distrib)
[PROOF STATE]
proof (state)
this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * real_of_int v / real p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * real_of_int v / real p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> (real t-1) + 3 * sqrt (real m * (real t * real p / (real m * (1- \<delta>'))) / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - 1 + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p)
[PROOF STEP]
by (intro add_mono mult_left_mono real_sqrt_le_mono divide_right_mono)
         (auto simp add:v_def)
[PROOF STATE]
proof (state)
this:
real t - 1 + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - 1 + 3 * sqrt (real m * real_of_int v / real p) \<le> real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real t + 3 * sqrt(real t / (1-\<delta>')) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p) \<le> real t + 3 * sqrt (real t / (1 - \<delta>')) - 1
[PROOF STEP]
using m_ge_0 p_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < real m
0 < p

goal (1 subgoal):
 1. real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p) \<le> real t + 3 * sqrt (real t / (1 - \<delta>')) - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p) \<le> real t + 3 * sqrt (real t / (1 - \<delta>')) - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t - 1 + 3 * sqrt (real m * (real t * real p / (real m * (1 - \<delta>'))) / real p) \<le> real t + 3 * sqrt (real t / (1 - \<delta>')) - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real t / (1-\<delta>')-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t + 3 * sqrt (real t / (1 - \<delta>')) - 1 \<le> real t / (1 - \<delta>') - 1
[PROOF STEP]
using \<delta>'_lt_1 aux
[PROOF STATE]
proof (prove)
using this:
\<delta>' < 1
(real t + 3 * sqrt (real t / (1 - \<delta>'))) * (1 - \<delta>') \<le> real t

goal (1 subgoal):
 1. real t + 3 * sqrt (real t / (1 - \<delta>')) - 1 \<le> real t / (1 - \<delta>') - 1
[PROOF STEP]
by (simp add: pos_le_divide_eq)
[PROOF STATE]
proof (state)
this:
real t + 3 * sqrt (real t / (1 - \<delta>')) - 1 \<le> real t / (1 - \<delta>') - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t + 3 * sqrt (real t / (1 - \<delta>')) - 1 \<le> real t / (1 - \<delta>') - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real m * (real t * real p / (real m * (1-\<delta>'))) / real p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t / (1 - \<delta>') - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1
[PROOF STEP]
using p_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < real m

goal (1 subgoal):
 1. real t / (1 - \<delta>') - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t / (1 - \<delta>') - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t / (1 - \<delta>') - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le> real m * (real t * real p / (real m * (1-\<delta>'))) / real p - real m / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p
[PROOF STEP]
using m_le_p p_gt_0
[PROOF STATE]
proof (prove)
using this:
m \<le> p
0 < p

goal (1 subgoal):
 1. real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p
[PROOF STEP]
by (intro diff_mono, auto)
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - 1 \<le> real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... = real m * (real t * real p / (real m * (1-\<delta>'))-1) / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p = real m * (real t * real p / (real m * (1 - \<delta>')) - 1) / real p
[PROOF STEP]
by (simp add: left_diff_distrib right_diff_distrib diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p = real m * (real t * real p / (real m * (1 - \<delta>')) - 1) / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 - \<delta>'))) / real p - real m / real p = real m * (real t * real p / (real m * (1 - \<delta>')) - 1) / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
have "... \<le>  real m * real_of_int v / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * (real t * real p / (real m * (1 - \<delta>')) - 1) / real p \<le> real m * real_of_int v / real p
[PROOF STEP]
by (intro divide_right_mono mult_left_mono, simp_all add:v_def)
[PROOF STATE]
proof (state)
this:
real m * (real t * real p / (real m * (1 - \<delta>')) - 1) / real p \<le> real m * real_of_int v / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p
[PROOF STEP]
have "real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p)
        \<le> real m * real_of_int v / real p"
[PROOF STATE]
proof (prove)
using this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p

goal (1 subgoal):
 1. real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
hence " 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) -expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>"
[PROOF STATE]
proof (prove)
using this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>
[PROOF STEP]
using v_gt_0 True
[PROOF STATE]
proof (prove)
using this:
real (Q v \<omega>) + 3 * sqrt (real m * real_of_int v / real p) \<le> real m * real_of_int v / real p
0 < v
v \<le> int p

goal (1 subgoal):
 1. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>
[PROOF STEP]
by (simp add: exp_Q abs_ge_iff)
[PROOF STATE]
proof (state)
this:
3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
thus "\<omega> \<in> {\<omega>\<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le>
        \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}"
[PROOF STATE]
proof (prove)
using this:
3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>

goal (1 subgoal):
 1. \<omega> \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}
[PROOF STEP]
by (simp add:M_def)
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>}

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "... \<le> variance (\<lambda>\<omega>. real (Q v \<omega>)) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2
[PROOF STEP]
using v_gt_0 p_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < v
0 < p
0 < real m

goal (1 subgoal):
 1. prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2
[PROOF STEP]
by (intro Chebyshev_inequality, simp add:M_def, auto)
[PROOF STATE]
proof (state)
this:
prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega> \<in> Sigma_Algebra.space M. 3 * sqrt (real m * real_of_int v / real p) \<le> \<bar>real (Q v \<omega>) - expectation (\<lambda>\<omega>. real (Q v \<omega>))\<bar>} \<le> expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "... \<le> (real m * real_of_int v / real p) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 \<le> real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2
[PROOF STEP]
using  v_gt_0 True
[PROOF STATE]
proof (prove)
using this:
0 < v
v \<le> int p

goal (1 subgoal):
 1. expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 \<le> real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2
[PROOF STEP]
by (intro divide_right_mono var_Q, auto)
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 \<le> real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
expectation (\<lambda>x. (real (Q v x) - expectation (\<lambda>\<omega>. real (Q v \<omega>)))\<^sup>2) / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 \<le> real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "... = 1/9"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 = 1 / 9
[PROOF STEP]
using p_gt_0 v_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < v
0 < real m

goal (1 subgoal):
 1. real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 = 1 / 9
[PROOF STEP]
by (simp add:power2_eq_square)
[PROOF STATE]
proof (state)
this:
real m * real_of_int v / real p / (3 * sqrt (real m * real_of_int v / real p))\<^sup>2 = 1 / 9

goal (2 subgoals):
 1. v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
 2. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9

goal (1 subgoal):
 1. prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9

goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> v \<le> int p

goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega>. False}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega>. False}
[PROOF STEP]
proof (rule pmf_mono[OF M_def])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
assume a:"\<omega> \<in> {\<omega>. Q v \<omega> < t}"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. Q v \<omega> < t}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
assume "\<omega> \<in> set_pmf (pmf_of_set space)"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
hence b:"\<And>x. x < p \<Longrightarrow> hash x \<omega> < p"
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. \<And>x. x < p \<Longrightarrow> Frequency_Moment_0.hash p x \<omega> < p
[PROOF STEP]
using hash_range mod_ring_carr
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> set_pmf (pmf_of_set local.space)
\<lbrakk>?\<omega> \<in> local.space; ?x \<in> carrier (Field.mod_ring p)\<rbrakk> \<Longrightarrow> Frequency_Moment_0.hash p ?x ?\<omega> \<in> carrier (Field.mod_ring p)
(?x \<in> carrier (Field.mod_ring ?n)) = (?x < ?n)

goal (1 subgoal):
 1. \<And>x. x < p \<Longrightarrow> Frequency_Moment_0.hash p x \<omega> < p
[PROOF STEP]
by (simp add:M_def measure_pmf_inverse)
[PROOF STATE]
proof (state)
this:
?x1 < p \<Longrightarrow> Frequency_Moment_0.hash p ?x1 \<omega> < p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
have "t \<le> card (set as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<le> card (set as)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
t \<le> card (set as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
have "... \<le> Q v \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set as) \<le> Q v \<omega>
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set as) \<le> card {x \<in> set as. int (Frequency_Moment_0.hash p x \<omega>) < v}
[PROOF STEP]
using b False as_lt_p
[PROOF STATE]
proof (prove)
using this:
?x1 < p \<Longrightarrow> Frequency_Moment_0.hash p ?x1 \<omega> < p
\<not> v \<le> int p
?x \<in> set as \<Longrightarrow> ?x < p

goal (1 subgoal):
 1. card (set as) \<le> card {x \<in> set as. int (Frequency_Moment_0.hash p x \<omega>) < v}
[PROOF STEP]
by (intro card_mono subsetI, simp, force)
[PROOF STATE]
proof (state)
this:
card (set as) \<le> Q v \<omega>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (set as) \<le> Q v \<omega>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
have "... < t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q v \<omega> < t
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> {\<omega>. Q v \<omega> < t}

goal (1 subgoal):
 1. Q v \<omega> < t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Q v \<omega> < t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
t < t
[PROOF STEP]
have "False"
[PROOF STATE]
proof (prove)
using this:
t < t

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. Q v \<omega> < t}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. False}
[PROOF STEP]
thus "\<omega> \<in> {\<omega>. False}"
[PROOF STATE]
proof (prove)
using this:
False

goal (1 subgoal):
 1. \<omega> \<in> {\<omega>. False}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. False}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega>. False}

goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> prob {\<omega>. False}

goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. False} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prob {\<omega>. False} = 0

goal (1 subgoal):
 1. \<not> v \<le> int p \<Longrightarrow> prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. Q v \<omega> < t} \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. Q v \<omega> < t} \<le> 0

goal (1 subgoal):
 1. prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. Q v \<omega> < t} \<le> 1 / 9

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "prob {\<omega>. \<not>has_no_collision \<omega>} \<le>
    prob {\<omega>. \<exists>x \<in> set as. \<exists>y \<in> set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. \<not> has_no_collision \<omega>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
by (rule pmf_mono[OF M_def]) (simp add:has_no_collision_def M_def, force)
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<not> has_no_collision \<omega>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<not> has_no_collision \<omega>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (5/2) * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
using collision_prob v_ge_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?c \<Longrightarrow> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> ?c \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * ?c\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
1 \<le> real_of_int v

goal (1 subgoal):
 1. prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real_of_int v \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (5/2) * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
by (intro divide_right_mono add_mono mult_right_mono mult_mono power_mono, simp_all add:m_def)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (5/2) * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * (2 powr - real r) / (real p)\<^sup>2 + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
using v_def v_ge_1 v_ubound
[PROOF STATE]
proof (prove)
using this:
v = \<lfloor>real t * real p / (real m * (1 - \<delta>'))\<rfloor>
1 \<le> real_of_int v
real_of_int v \<le> 4 * real t * real p / real m

goal (1 subgoal):
 1. 5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
by (intro add_mono divide_right_mono  mult_right_mono  mult_left_mono, auto)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real m)\<^sup>2 * (real_of_int v)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p \<le> 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = 40 * (real t)\<^sup>2 * (2 powr -real r) + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
using p_gt_0 m_ge_0 t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < real m
0 < t

goal (1 subgoal):
 1. 5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
by (simp add:algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real m)\<^sup>2 * (4 * real t * real p / real m)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1/18 + 1/18"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 18 + 1 / 18
[PROOF STEP]
using t_r_bound p_ge_18
[PROOF STATE]
proof (prove)
using this:
18 * 40 * (real t)\<^sup>2 * 2 powr - real r \<le> 1
18 \<le> p

goal (1 subgoal):
 1. 40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 18 + 1 / 18
[PROOF STEP]
by (intro add_mono, simp_all add: pos_le_divide_eq)
[PROOF STATE]
proof (state)
this:
40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 18 + 1 / 18

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
40 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 18 + 1 / 18

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = 1/9"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 18 + 1 / 18 = 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 18 + 1 / 18 = 1 / 9

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. \<not> has_no_collision \<omega>} \<le> 1 / 9
[PROOF STEP]
have case_3: "prob {\<omega>. \<not>has_no_collision \<omega>} \<le> 1/9"
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. \<not> has_no_collision \<omega>} \<le> 1 / 9

goal (1 subgoal):
 1. prob {\<omega>. \<not> has_no_collision \<omega>} \<le> 1 / 9
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<not> has_no_collision \<omega>} \<le> 1 / 9

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "prob {\<omega>. real_of_rat \<delta> * of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - of_rat (F 0 as)\<bar>} \<le>
    prob {\<omega>. Q u \<omega> \<ge> t \<or> Q v \<omega> < t \<or> \<not>(has_no_collision \<omega>)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}
[PROOF STEP]
proof (rule pmf_mono[OF M_def], rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "\<omega> \<in> set_pmf (pmf_of_set space)"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence est: "real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>"
[PROOF STATE]
proof (prove)
using this:
\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}

goal (1 subgoal):
 1. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "\<omega> \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}"
[PROOF STATE]
proof (state)
this:
\<omega> \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence "\<not>( t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>)"
[PROOF STATE]
proof (prove)
using this:
\<omega> \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}

goal (1 subgoal):
 1. \<not> (t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> (t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence lb: "Q u \<omega> < t" and ub: "Q v \<omega> \<ge> t" and no_col: "has_no_collision \<omega>"
[PROOF STATE]
proof (prove)
using this:
\<not> (t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>)

goal (1 subgoal):
 1. Q u \<omega> < t &&& t \<le> Q v \<omega> &&& has_no_collision \<omega>
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
Q u \<omega> < t
t \<le> Q v \<omega>
has_no_collision \<omega>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define y where "y =  nth_mset (t-1) {#int (hash x \<omega>). x \<in># mset_set (set as)#}"
[PROOF STATE]
proof (state)
this:
y = nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define y' where "y' = nth_mset (t-1) {#tr_hash x \<omega>. x \<in># mset_set (set as)#}"
[PROOF STATE]
proof (state)
this:
y' = nth_mset (t - 1) {#tr_hash x \<omega>. x \<in># mset_set (set as)#}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have rank_t_lb: "u \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<le> y
[PROOF STEP]
unfolding y_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<le> nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#}
[PROOF STEP]
using True t_gt_0 lb
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
0 < t
Q u \<omega> < t

goal (1 subgoal):
 1. u \<le> nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#}
[PROOF STEP]
by (intro nth_mset_bound_left, simp_all add:count_less_def swap_filter_image Q_def)
[PROOF STATE]
proof (state)
this:
u \<le> y

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have rank_t_ub: "y \<le> v - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> v - 1
[PROOF STEP]
unfolding y_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#} \<le> v - 1
[PROOF STEP]
using True t_gt_0 ub
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
0 < t
t \<le> Q v \<omega>

goal (1 subgoal):
 1. nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#} \<le> v - 1
[PROOF STEP]
by (intro nth_mset_bound_right, simp_all add:Q_def swap_filter_image count_le_def)
[PROOF STATE]
proof (state)
this:
y \<le> v - 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have y_ge_0: "real_of_int y \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of_int y
[PROOF STEP]
using rank_t_lb a_ge_0
[PROOF STATE]
proof (prove)
using this:
u \<le> y
0 \<le> u

goal (1 subgoal):
 1. 0 \<le> real_of_int y
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 \<le> real_of_int y

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "mono (\<lambda>x. truncate_down r (real_of_int x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono (\<lambda>x. truncate_down r (real_of_int x))
[PROOF STEP]
by (metis truncate_down_mono mono_def of_int_le_iff)
[PROOF STATE]
proof (state)
this:
mono (\<lambda>x. truncate_down r (real_of_int x))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence y'_eq: "y' = truncate_down r y"
[PROOF STATE]
proof (prove)
using this:
mono (\<lambda>x. truncate_down r (real_of_int x))

goal (1 subgoal):
 1. y' = truncate_down r (real_of_int y)
[PROOF STEP]
unfolding y_def y'_def
[PROOF STATE]
proof (prove)
using this:
mono (\<lambda>x. truncate_down r (real_of_int x))

goal (1 subgoal):
 1. nth_mset (t - 1) {#tr_hash x \<omega>. x \<in># mset_set (set as)#} = truncate_down r (real_of_int (nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#}))
[PROOF STEP]
using True t_gt_0
[PROOF STATE]
proof (prove)
using this:
mono (\<lambda>x. truncate_down r (real_of_int x))
t \<le> card (set as)
0 < t

goal (1 subgoal):
 1. nth_mset (t - 1) {#tr_hash x \<omega>. x \<in># mset_set (set as)#} = truncate_down r (real_of_int (nth_mset (t - 1) {#int (Frequency_Moment_0.hash p x \<omega>). x \<in># mset_set (set as)#}))
[PROOF STEP]
by (subst nth_mset_commute_mono[where f="(\<lambda>x. truncate_down r (of_int x))"])
        (simp_all add: multiset.map_comp comp_def tr_hash_def)
[PROOF STATE]
proof (state)
this:
y' = truncate_down r (real_of_int y)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "real_of_int u * (1 - 2 powr -real r) \<le> real_of_int y * (1 - 2 powr (-real r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int u * (1 - 2 powr - real r) \<le> real_of_int y * (1 - 2 powr - real r)
[PROOF STEP]
using rank_t_lb of_int_le_iff two_pow_r_le_1
[PROOF STATE]
proof (prove)
using this:
u \<le> y
(of_int ?w \<le> of_int ?z) = (?w \<le> ?z)
0 < 1 - 2 powr - real r

goal (1 subgoal):
 1. real_of_int u * (1 - 2 powr - real r) \<le> real_of_int y * (1 - 2 powr - real r)
[PROOF STEP]
by (intro mult_right_mono, auto)
[PROOF STATE]
proof (state)
this:
real_of_int u * (1 - 2 powr - real r) \<le> real_of_int y * (1 - 2 powr - real r)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int u * (1 - 2 powr - real r) \<le> real_of_int y * (1 - 2 powr - real r)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int y * (1 - 2 powr - real r) \<le> y'
[PROOF STEP]
using y'_eq truncate_down_pos[OF y_ge_0]
[PROOF STATE]
proof (prove)
using this:
y' = truncate_down r (real_of_int y)
real_of_int y * (1 - 2 powr - real ?prec) \<le> truncate_down ?prec (real_of_int y)

goal (1 subgoal):
 1. real_of_int y * (1 - 2 powr - real r) \<le> y'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int y * (1 - 2 powr - real r) \<le> y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int u * (1 - 2 powr - real r) \<le> y'
[PROOF STEP]
have rank_t_lb': "u * (1 - 2 powr -real r) \<le> y'"
[PROOF STATE]
proof (prove)
using this:
real_of_int u * (1 - 2 powr - real r) \<le> y'

goal (1 subgoal):
 1. real_of_int u * (1 - 2 powr - real r) \<le> y'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int u * (1 - 2 powr - real r) \<le> y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "y' \<le> real_of_int y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y' \<le> real_of_int y
[PROOF STEP]
by (subst y'_eq, rule truncate_down_le, simp)
[PROOF STATE]
proof (state)
this:
y' \<le> real_of_int y

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y' \<le> real_of_int y

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> real_of_int (v-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int y \<le> real_of_int (v - 1)
[PROOF STEP]
using rank_t_ub of_int_le_iff
[PROOF STATE]
proof (prove)
using this:
y \<le> v - 1
(of_int ?w \<le> of_int ?z) = (?w \<le> ?z)

goal (1 subgoal):
 1. real_of_int y \<le> real_of_int (v - 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_int y \<le> real_of_int (v - 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
y' \<le> real_of_int (v - 1)
[PROOF STEP]
have rank_t_ub': "y' \<le> v-1"
[PROOF STATE]
proof (prove)
using this:
y' \<le> real_of_int (v - 1)

goal (1 subgoal):
 1. y' \<le> real_of_int (v - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y' \<le> real_of_int (v - 1)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "0 < u * (1-2 powr -real r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < real_of_int u * (1 - 2 powr - real r)
[PROOF STEP]
using a_ge_1 two_pow_r_le_1
[PROOF STATE]
proof (prove)
using this:
1 \<le> u
0 < 1 - 2 powr - real r

goal (1 subgoal):
 1. 0 < real_of_int u * (1 - 2 powr - real r)
[PROOF STEP]
by (intro mult_pos_pos, auto)
[PROOF STATE]
proof (state)
this:
0 < real_of_int u * (1 - 2 powr - real r)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence y'_pos: "y' > 0"
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int u * (1 - 2 powr - real r)

goal (1 subgoal):
 1. 0 < y'
[PROOF STEP]
using rank_t_lb'
[PROOF STATE]
proof (prove)
using this:
0 < real_of_int u * (1 - 2 powr - real r)
real_of_int u * (1 - 2 powr - real r) \<le> y'

goal (1 subgoal):
 1. 0 < y'
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have no_col': "\<And>x. x \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} x \<le> 1
[PROOF STEP]
using  rank_t_ub' no_col
[PROOF STATE]
proof (prove)
using this:
y' \<le> real_of_int (v - 1)
has_no_collision \<omega>

goal (1 subgoal):
 1. \<And>x. x \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} x \<le> 1
[PROOF STEP]
by (simp add:vimage_def card_le_Suc0_iff_eq count_image_mset has_no_collision_def) force
[PROOF STATE]
proof (state)
this:
?x1 \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} ?x1 \<le> 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have h_1: "Max (sketch_rv' \<omega>) = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (sketch_rv' \<omega>) = y'
[PROOF STEP]
using True t_gt_0 no_col'
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
0 < t
?x1 \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} ?x1 \<le> 1

goal (1 subgoal):
 1. Max (sketch_rv' \<omega>) = y'
[PROOF STEP]
by (simp add:sketch_rv'_def y'_def nth_mset_max)
[PROOF STATE]
proof (state)
this:
Max (sketch_rv' \<omega>) = y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "card (sketch_rv' \<omega>) = card (least ((t-1)+1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sketch_rv' \<omega>) = card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#}))
[PROOF STEP]
using t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < t

goal (1 subgoal):
 1. card (sketch_rv' \<omega>) = card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#}))
[PROOF STEP]
by (simp add:sketch_rv'_def)
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) = card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#}))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) = card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#}))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... = (t-1) +1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#})) = t - 1 + 1
[PROOF STEP]
using True t_gt_0 no_col'
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
0 < t
?x1 \<le> y' \<Longrightarrow> count {#tr_hash x \<omega>. x \<in># mset_set (set as)#} ?x1 \<le> 1

goal (1 subgoal):
 1. card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#})) = t - 1 + 1
[PROOF STEP]
by (intro nth_mset_max(2), simp_all add:y'_def)
[PROOF STATE]
proof (state)
this:
card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#})) = t - 1 + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (K_Smallest.least (t - 1 + 1) (set_mset {#tr_hash x \<omega>. x \<in># mset_set (set as)#})) = t - 1 + 1

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t - 1 + 1 = t
[PROOF STEP]
using t_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < t

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (sketch_rv' \<omega>) = t
[PROOF STEP]
have "card (sketch_rv' \<omega>) = t"
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) = t

goal (1 subgoal):
 1. card (sketch_rv' \<omega>) = t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) = t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence h_3: "estimate' (sketch_rv' \<omega>) = real t * real p / y'"
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) = t

goal (1 subgoal):
 1. estimate' (sketch_rv' \<omega>) = real t * real p / y'
[PROOF STEP]
using h_1
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) = t
Max (sketch_rv' \<omega>) = y'

goal (1 subgoal):
 1. estimate' (sketch_rv' \<omega>) = real t * real p / y'
[PROOF STEP]
by (simp add:estimate'_def)
[PROOF STATE]
proof (state)
this:
estimate' (sketch_rv' \<omega>) = real t * real p / y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "(real t) * real p \<le>  (1 + \<delta>') * real m * ((real t) * real p / (real m * (1 + \<delta>')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real t * real p \<le> (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>')))
[PROOF STEP]
using \<delta>'_lt_1 m_def True t_gt_0 \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
\<delta>' < 1
m = card (set as)
t \<le> card (set as)
0 < t
0 < \<delta>'

goal (1 subgoal):
 1. real t * real p \<le> (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>')))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real t * real p \<le> (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real t * real p \<le> (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>')))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> (1+\<delta>') * m * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>'))) \<le> (1 + \<delta>') * real m * real_of_int u
[PROOF STEP]
using \<delta>'_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'

goal (1 subgoal):
 1. (1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>'))) \<le> (1 + \<delta>') * real m * real_of_int u
[PROOF STEP]
by (intro mult_left_mono, simp_all add:u_def)
[PROOF STATE]
proof (state)
this:
(1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>'))) \<le> (1 + \<delta>') * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + \<delta>') * real m * (real t * real p / (real m * (1 + \<delta>'))) \<le> (1 + \<delta>') * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... < ((1 + real_of_rat \<delta>)*(1-real_of_rat \<delta>/8)) * m * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + \<delta>') * real m * real_of_int u < (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u
[PROOF STEP]
using True m_def t_gt_0 a_ge_1 \<delta>_range
[PROOF STATE]
proof (prove)
using this:
t \<le> card (set as)
m = card (set as)
0 < t
1 \<le> u
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. (1 + \<delta>') * real m * real_of_int u < (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u
[PROOF STEP]
by (intro mult_strict_right_mono, auto simp add:\<delta>'_def right_diff_distrib)
[PROOF STATE]
proof (state)
this:
(1 + \<delta>') * real m * real_of_int u < (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + \<delta>') * real m * real_of_int u < (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> ((1 + real_of_rat \<delta>)*(1-2 powr (-r))) * m * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u \<le> (1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u
[PROOF STEP]
using r_le_\<delta> \<delta>_range a_ge_0
[PROOF STATE]
proof (prove)
using this:
2 powr - real r < real_of_rat \<delta> / 8
\<delta> \<in> {0<..<1}
0 \<le> u

goal (1 subgoal):
 1. (1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u \<le> (1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u
[PROOF STEP]
by (intro mult_right_mono mult_left_mono, auto)
[PROOF STATE]
proof (state)
this:
(1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u \<le> (1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + real_of_rat \<delta>) * (1 - real_of_rat \<delta> / 8) * real m * real_of_int u \<le> (1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... = (1 + real_of_rat \<delta>) * m * (u * (1-2 powr -real r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u = (1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u = (1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + real_of_rat \<delta>) * (1 - 2 powr real_of_int (- int r)) * real m * real_of_int u = (1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> (1 + real_of_rat \<delta>) * m * y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r)) \<le> (1 + real_of_rat \<delta>) * real m * y'
[PROOF STEP]
using \<delta>_range
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. (1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r)) \<le> (1 + real_of_rat \<delta>) * real m * y'
[PROOF STEP]
by (intro mult_left_mono rank_t_lb', simp)
[PROOF STATE]
proof (state)
this:
(1 + real_of_rat \<delta>) * real m * (real_of_int u * (1 - 2 powr - real r)) \<le> (1 + real_of_rat \<delta>) * real m * y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real t * real p < (1 + real_of_rat \<delta>) * real m * y'
[PROOF STEP]
have "real t * real p < (1 + real_of_rat \<delta>) * m * y'"
[PROOF STATE]
proof (prove)
using this:
real t * real p < (1 + real_of_rat \<delta>) * real m * y'

goal (1 subgoal):
 1. real t * real p < (1 + real_of_rat \<delta>) * real m * y'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real t * real p < (1 + real_of_rat \<delta>) * real m * y'

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence f_1: "estimate' (sketch_rv' \<omega>) < (1 + real_of_rat \<delta>) * m"
[PROOF STATE]
proof (prove)
using this:
real t * real p < (1 + real_of_rat \<delta>) * real m * y'

goal (1 subgoal):
 1. estimate' (sketch_rv' \<omega>) < (1 + real_of_rat \<delta>) * real m
[PROOF STEP]
using y'_pos
[PROOF STATE]
proof (prove)
using this:
real t * real p < (1 + real_of_rat \<delta>) * real m * y'
0 < y'

goal (1 subgoal):
 1. estimate' (sketch_rv' \<omega>) < (1 + real_of_rat \<delta>) * real m
[PROOF STEP]
by (simp add: h_3 pos_divide_less_eq)
[PROOF STATE]
proof (state)
this:
estimate' (sketch_rv' \<omega>) < (1 + real_of_rat \<delta>) * real m

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "(1 - real_of_rat \<delta>) * m * y' \<le> (1 - real_of_rat \<delta>) * m * v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m * y' \<le> (1 - real_of_rat \<delta>) * real m * real_of_int v
[PROOF STEP]
using \<delta>_range rank_t_ub' y'_pos
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}
y' \<le> real_of_int (v - 1)
0 < y'

goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m * y' \<le> (1 - real_of_rat \<delta>) * real m * real_of_int v
[PROOF STEP]
by (intro mult_mono rank_t_ub', simp_all)
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m * y' \<le> (1 - real_of_rat \<delta>) * real m * real_of_int v

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m * y' \<le> (1 - real_of_rat \<delta>) * real m * real_of_int v

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... = (1-real_of_rat \<delta>) * (real m * v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m * real_of_int v = (1 - real_of_rat \<delta>) * (real m * real_of_int v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m * real_of_int v = (1 - real_of_rat \<delta>) * (real m * real_of_int v)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m * real_of_int v = (1 - real_of_rat \<delta>) * (real m * real_of_int v)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... < (1-\<delta>') * (real m * v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * (real m * real_of_int v) < (1 - \<delta>') * (real m * real_of_int v)
[PROOF STEP]
using \<delta>_range m_ge_0 v_ge_1
[PROOF STATE]
proof (prove)
using this:
\<delta> \<in> {0<..<1}
0 < real m
1 \<le> real_of_int v

goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * (real m * real_of_int v) < (1 - \<delta>') * (real m * real_of_int v)
[PROOF STEP]
by (intro mult_strict_right_mono mult_pos_pos, simp_all add:\<delta>'_def)
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * (real m * real_of_int v) < (1 - \<delta>') * (real m * real_of_int v)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * (real m * real_of_int v) < (1 - \<delta>') * (real m * real_of_int v)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... \<le> (1-\<delta>') * (real m * (real t * real p / (real m * (1-\<delta>'))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - \<delta>') * (real m * real_of_int v) \<le> (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>'))))
[PROOF STEP]
using \<delta>'_gt_0 \<delta>'_lt_1
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
\<delta>' < 1

goal (1 subgoal):
 1. (1 - \<delta>') * (real m * real_of_int v) \<le> (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>'))))
[PROOF STEP]
by (intro mult_left_mono, auto simp add:v_def)
[PROOF STATE]
proof (state)
this:
(1 - \<delta>') * (real m * real_of_int v) \<le> (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>'))))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 - \<delta>') * (real m * real_of_int v) \<le> (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>'))))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "... = real t * real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>')))) = real t * real p
[PROOF STEP]
using \<delta>'_gt_0 \<delta>'_lt_1 t_gt_0 p_gt_0 m_ge_0
[PROOF STATE]
proof (prove)
using this:
0 < \<delta>'
\<delta>' < 1
0 < t
0 < p
0 < real m

goal (1 subgoal):
 1. (1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>')))) = real t * real p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 - \<delta>') * (real m * (real t * real p / (real m * (1 - \<delta>')))) = real t * real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 - real_of_rat \<delta>) * real m * y' < real t * real p
[PROOF STEP]
have "(1 - real_of_rat \<delta>) * m * y' < real t * real p"
[PROOF STATE]
proof (prove)
using this:
(1 - real_of_rat \<delta>) * real m * y' < real t * real p

goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m * y' < real t * real p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m * y' < real t * real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
hence f_2: "estimate' (sketch_rv' \<omega>) > (1 - real_of_rat \<delta>) * m"
[PROOF STATE]
proof (prove)
using this:
(1 - real_of_rat \<delta>) * real m * y' < real t * real p

goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m < estimate' (sketch_rv' \<omega>)
[PROOF STEP]
using y'_pos
[PROOF STATE]
proof (prove)
using this:
(1 - real_of_rat \<delta>) * real m * y' < real t * real p
0 < y'

goal (1 subgoal):
 1. (1 - real_of_rat \<delta>) * real m < estimate' (sketch_rv' \<omega>)
[PROOF STEP]
by (simp add: h_3 pos_less_divide_eq)
[PROOF STATE]
proof (state)
this:
(1 - real_of_rat \<delta>) * real m < estimate' (sketch_rv' \<omega>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "abs (estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)) < real_of_rat \<delta> * (real_of_rat (F 0 as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar> < real_of_rat \<delta> * real_of_rat (F 0 as)
[PROOF STEP]
using f_1 f_2
[PROOF STATE]
proof (prove)
using this:
estimate' (sketch_rv' \<omega>) < (1 + real_of_rat \<delta>) * real m
(1 - real_of_rat \<delta>) * real m < estimate' (sketch_rv' \<omega>)

goal (1 subgoal):
 1. \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar> < real_of_rat \<delta> * real_of_rat (F 0 as)
[PROOF STEP]
by (simp add:abs_less_iff algebra_simps m_eq_F_0)
[PROOF STATE]
proof (state)
this:
\<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar> < real_of_rat \<delta> * real_of_rat (F 0 as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space); x \<notin> {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
thus "False"
[PROOF STATE]
proof (prove)
using this:
\<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar> < real_of_rat \<delta> * real_of_rat (F 0 as)

goal (1 subgoal):
 1. False
[PROOF STEP]
using est
[PROOF STATE]
proof (prove)
using this:
\<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar> < real_of_rat \<delta> * real_of_rat (F 0 as)
real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>}

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1/9 + (1/9 + 1/9)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>} \<le> 1 / 9 + (1 / 9 + 1 / 9)
[PROOF STEP]
by (intro pmf_add_2[OF M_def] case_1 case_2 case_3)
[PROOF STATE]
proof (state)
this:
prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>} \<le> 1 / 9 + (1 / 9 + 1 / 9)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. t \<le> Q u \<omega> \<or> Q v \<omega> < t \<or> \<not> has_no_collision \<omega>} \<le> 1 / 9 + (1 / 9 + 1 / 9)

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = 1/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 9 + (1 / 9 + 1 / 9) = 1 / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 9 + (1 / 9 + 1 / 9) = 1 / 3

goal (2 subgoals):
 1. t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
 2. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3

goal (1 subgoal):
 1. prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> t \<le> card (set as)

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "prob {\<omega>. real_of_rat \<delta> * of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - of_rat (F 0 as)\<bar>} \<le>
    prob {\<omega>. \<exists>x \<in> set as. \<exists>y \<in> set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
proof (rule pmf_mono[OF M_def])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
fix \<omega>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
assume a:"\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
assume b:"\<omega> \<in> set_pmf (pmf_of_set space)"
[PROOF STATE]
proof (state)
this:
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
have c: "card (set as) < t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set as) < t
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> t \<le> card (set as)

goal (1 subgoal):
 1. card (set as) < t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set as) < t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence "card ((\<lambda>x. tr_hash x \<omega>) ` set as) < t"
[PROOF STATE]
proof (prove)
using this:
card (set as) < t

goal (1 subgoal):
 1. card ((\<lambda>x. tr_hash x \<omega>) ` set as) < t
[PROOF STEP]
using card_image_le order_le_less_trans
[PROOF STATE]
proof (prove)
using this:
card (set as) < t
finite ?A \<Longrightarrow> card (?f ` ?A) \<le> card ?A
\<lbrakk>?x \<le> ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. card ((\<lambda>x. tr_hash x \<omega>) ` set as) < t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card ((\<lambda>x. tr_hash x \<omega>) ` set as) < t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence d:"card (sketch_rv' \<omega>) = card ((\<lambda>x. tr_hash x \<omega>) ` (set as))"
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>x. tr_hash x \<omega>) ` set as) < t

goal (1 subgoal):
 1. card (sketch_rv' \<omega>) = card ((\<lambda>x. tr_hash x \<omega>) ` set as)
[PROOF STEP]
by (simp add:sketch_rv'_def card_least)
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) = card ((\<lambda>x. tr_hash x \<omega>) ` set as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
have "card (sketch_rv' \<omega>) < t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sketch_rv' \<omega>) < t
[PROOF STEP]
by (metis List.finite_set  c d card_image_le  order_le_less_trans)
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) < t

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence "estimate' (sketch_rv' \<omega>) = card (sketch_rv' \<omega>)"
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) < t

goal (1 subgoal):
 1. estimate' (sketch_rv' \<omega>) = real (card (sketch_rv' \<omega>))
[PROOF STEP]
by (simp add:estimate'_def)
[PROOF STATE]
proof (state)
this:
estimate' (sketch_rv' \<omega>) = real (card (sketch_rv' \<omega>))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence "card (sketch_rv' \<omega>) \<noteq> real_of_rat (F 0 as)"
[PROOF STATE]
proof (prove)
using this:
estimate' (sketch_rv' \<omega>) = real (card (sketch_rv' \<omega>))

goal (1 subgoal):
 1. real (card (sketch_rv' \<omega>)) \<noteq> real_of_rat (F 0 as)
[PROOF STEP]
using a \<delta>_range
[PROOF STATE]
proof (prove)
using this:
estimate' (sketch_rv' \<omega>) = real (card (sketch_rv' \<omega>))
\<omega> \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}
\<delta> \<in> {0<..<1}

goal (1 subgoal):
 1. real (card (sketch_rv' \<omega>)) \<noteq> real_of_rat (F 0 as)
[PROOF STEP]
by simp
        (metis abs_zero cancel_comm_monoid_add_class.diff_cancel of_nat_less_0_iff pos_prod_lt zero_less_of_rat_iff)
[PROOF STATE]
proof (state)
this:
real (card (sketch_rv' \<omega>)) \<noteq> real_of_rat (F 0 as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence "card (sketch_rv' \<omega>) \<noteq> card (set as)"
[PROOF STATE]
proof (prove)
using this:
real (card (sketch_rv' \<omega>)) \<noteq> real_of_rat (F 0 as)

goal (1 subgoal):
 1. card (sketch_rv' \<omega>) \<noteq> card (set as)
[PROOF STEP]
using m_def m_eq_F_0
[PROOF STATE]
proof (prove)
using this:
real (card (sketch_rv' \<omega>)) \<noteq> real_of_rat (F 0 as)
m = card (set as)
real m = real_of_rat (F 0 as)

goal (1 subgoal):
 1. card (sketch_rv' \<omega>) \<noteq> card (set as)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card (sketch_rv' \<omega>) \<noteq> card (set as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
hence "\<not>inj_on (\<lambda>x. tr_hash x \<omega>) (set as)"
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) \<noteq> card (set as)

goal (1 subgoal):
 1. \<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)
[PROOF STEP]
using card_image d
[PROOF STATE]
proof (prove)
using this:
card (sketch_rv' \<omega>) \<noteq> card (set as)
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
card (sketch_rv' \<omega>) = card ((\<lambda>x. tr_hash x \<omega>) ` set as)

goal (1 subgoal):
 1. \<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
have "tr_hash x \<omega> \<le> real p" if a:"x \<in> set as" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tr_hash x \<omega> \<le> real p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tr_hash x \<omega> \<le> real p
[PROOF STEP]
have "hash x \<omega> < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Frequency_Moment_0.hash p x \<omega> < p
[PROOF STEP]
using hash_range as_lt_p a b
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<omega> \<in> local.space; ?x \<in> carrier (Field.mod_ring p)\<rbrakk> \<Longrightarrow> Frequency_Moment_0.hash p ?x ?\<omega> \<in> carrier (Field.mod_ring p)
?x \<in> set as \<Longrightarrow> ?x < p
x \<in> set as
\<omega> \<in> set_pmf (pmf_of_set local.space)

goal (1 subgoal):
 1. Frequency_Moment_0.hash p x \<omega> < p
[PROOF STEP]
by (simp add:mod_ring_carr M_def)
[PROOF STATE]
proof (state)
this:
Frequency_Moment_0.hash p x \<omega> < p

goal (1 subgoal):
 1. tr_hash x \<omega> \<le> real p
[PROOF STEP]
thus "tr_hash x \<omega> \<le> real p"
[PROOF STATE]
proof (prove)
using this:
Frequency_Moment_0.hash p x \<omega> < p

goal (1 subgoal):
 1. tr_hash x \<omega> \<le> real p
[PROOF STEP]
using truncate_down_le
[PROOF STATE]
proof (prove)
using this:
Frequency_Moment_0.hash p x \<omega> < p
?x \<le> ?y \<Longrightarrow> truncate_down ?prec ?x \<le> ?y

goal (1 subgoal):
 1. tr_hash x \<omega> \<le> real p
[PROOF STEP]
by (simp add:tr_hash_def)
[PROOF STATE]
proof (state)
this:
tr_hash x \<omega> \<le> real p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x1 \<in> set as \<Longrightarrow> tr_hash ?x1 \<omega> \<le> real p

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>}; x \<in> set_pmf (pmf_of_set local.space)\<rbrakk> \<Longrightarrow> x \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)
?x1 \<in> set as \<Longrightarrow> tr_hash ?x1 \<omega> \<le> real p
[PROOF STEP]
show "\<omega> \<in> {\<omega>. \<exists>x \<in> set as. \<exists>y \<in> set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}"
[PROOF STATE]
proof (prove)
using this:
\<not> inj_on (\<lambda>x. tr_hash x \<omega>) (set as)
?x1 \<in> set as \<Longrightarrow> tr_hash ?x1 \<omega> \<le> real p

goal (1 subgoal):
 1. \<omega> \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}
[PROOF STEP]
by (simp add:inj_on_def, blast)
[PROOF STATE]
proof (state)
this:
\<omega> \<in> {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>}

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (5/2) * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
using p_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < p

goal (1 subgoal):
 1. prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p
[PROOF STEP]
by (intro collision_prob, auto)
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob {\<omega>. \<exists>x\<in>set as. \<exists>y\<in>set as. x \<noteq> y \<and> tr_hash x \<omega> \<le> real p \<and> tr_hash x \<omega> = tr_hash y \<omega>} \<le> 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... = (5/2) * (real (card (set as)))\<^sup>2 * 2 powr (- real r) + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
using p_gt_0
[PROOF STATE]
proof (prove)
using this:
0 < p

goal (1 subgoal):
 1. 5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
by (simp add:ac_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * (real p)\<^sup>2 * 2 powr - real r / (real p)\<^sup>2 + 1 / real p = 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> (5/2) * (real t)\<^sup>2 * 2 powr (-real r) + 1 / real p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p \<le> 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> t \<le> card (set as)

goal (1 subgoal):
 1. 5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p \<le> 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p
[PROOF STEP]
by (intro add_mono mult_right_mono mult_left_mono power_mono, auto)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p \<le> 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real (card (set as)))\<^sup>2 * 2 powr - real r + 1 / real p \<le> 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1/6 + 1/6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 6 + 1 / 6
[PROOF STEP]
using t_r_bound p_ge_18
[PROOF STATE]
proof (prove)
using this:
18 * 40 * (real t)\<^sup>2 * 2 powr - real r \<le> 1
18 \<le> p

goal (1 subgoal):
 1. 5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 6 + 1 / 6
[PROOF STEP]
by (intro add_mono, simp_all)
[PROOF STATE]
proof (state)
this:
5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 6 + 1 / 6

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
5 / 2 * (real t)\<^sup>2 * 2 powr - real r + 1 / real p \<le> 1 / 6 + 1 / 6

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
have "... \<le> 1/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 6 + 1 / 6 \<le> 1 / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 6 + 1 / 6 \<le> 1 / 3

goal (1 subgoal):
 1. \<not> t \<le> card (set as) \<Longrightarrow> prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3

goal (1 subgoal):
 1. prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob {\<omega>. real_of_rat \<delta> * real_of_rat (F 0 as) < \<bar>estimate' (sketch_rv' \<omega>) - real_of_rat (F 0 as)\<bar>} \<le> 1 / 3

goal:
No subgoals!
[PROOF STEP]
qed