[STATEMENT]
lemma Dirichlet_L_minus_partial_sum_bound:
  fixes s :: complex and x :: real
  assumes "\<chi> \<noteq> \<chi>\<^sub>0" and "Re s > 0" and "x > 0"
  defines "\<sigma> \<equiv> Re s"
  shows   "norm (sum_upto (\<lambda>n. \<chi> n * n powr -s) x - Dirichlet_L n \<chi> s) \<le>
             real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (sum_upto (\<lambda>n. \<chi> n * of_nat n powr - s) x - Dirichlet_L n \<chi> s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
proof (rule Lim_norm_ubound)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?net \<noteq> bot
 2. (?f \<longlongrightarrow> sum_upto (\<lambda>n. \<chi> n * of_nat n powr - s) x - Dirichlet_L n \<chi> s) ?net
 3. \<forall>\<^sub>F xa in ?net. cmod (?f xa) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
[PROOF STEP]
have "summable (\<lambda>n. \<chi> n * of_nat n powr -s)"
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. summable (\<lambda>n. \<chi> n * of_nat n powr - s)
[PROOF STEP]
by (intro summable_Dirichlet_L')
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. \<chi> n * of_nat n powr - s)

goal (3 subgoals):
 1. ?net \<noteq> bot
 2. (?f \<longlongrightarrow> sum_upto (\<lambda>n. \<chi> n * of_nat n powr - s) x - Dirichlet_L n \<chi> s) ?net
 3. \<forall>\<^sub>F xa in ?net. cmod (?f xa) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
summable (\<lambda>n. \<chi> n * of_nat n powr - s)
[PROOF STEP]
have "(\<lambda>n. \<chi> n * of_nat n powr -s) sums Dirichlet_L n \<chi> s"
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
summable (\<lambda>n. \<chi> n * of_nat n powr - s)

goal (1 subgoal):
 1. (\<lambda>n. \<chi> n * of_nat n powr - s) sums Dirichlet_L n \<chi> s
[PROOF STEP]
using Dirichlet_L_conv_eval_fds[OF assms(1,2)]
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
summable (\<lambda>n. \<chi> n * of_nat n powr - s)
Dirichlet_L n \<chi> s = eval_fds (fds \<chi>) s

goal (1 subgoal):
 1. (\<lambda>n. \<chi> n * of_nat n powr - s) sums Dirichlet_L n \<chi> s
[PROOF STEP]
by (simp add: sums_iff eval_fds_def powr_minus divide_simps fds_nth_fds')
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<chi> n * of_nat n powr - s) sums Dirichlet_L n \<chi> s

goal (3 subgoals):
 1. ?net \<noteq> bot
 2. (?f \<longlongrightarrow> sum_upto (\<lambda>n. \<chi> n * of_nat n powr - s) x - Dirichlet_L n \<chi> s) ?net
 3. \<forall>\<^sub>F xa in ?net. cmod (?f xa) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
hence "(\<lambda>m. \<Sum>k\<le>m. \<chi> k * of_nat k powr -s) \<longlonglongrightarrow> Dirichlet_L n \<chi> s"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<chi> n * of_nat n powr - s) sums Dirichlet_L n \<chi> s

goal (1 subgoal):
 1. (\<lambda>m. \<Sum>k\<le>m. \<chi> k * of_nat k powr - s) \<longlonglongrightarrow> Dirichlet_L n \<chi> s
[PROOF STEP]
by (simp add: sums_def' atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. \<Sum>k\<le>m. \<chi> k * of_nat k powr - s) \<longlonglongrightarrow> Dirichlet_L n \<chi> s

goal (3 subgoals):
 1. ?net \<noteq> bot
 2. (?f \<longlongrightarrow> sum_upto (\<lambda>n. \<chi> n * of_nat n powr - s) x - Dirichlet_L n \<chi> s) ?net
 3. \<forall>\<^sub>F xa in ?net. cmod (?f xa) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
thus "(\<lambda>m. sum_upto (\<lambda>k. \<chi> k * of_nat k powr -s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr -s))
           \<longlonglongrightarrow> sum_upto (\<lambda>k. \<chi> k * of_nat k powr -s) x - Dirichlet_L n \<chi> s"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. \<Sum>k\<le>m. \<chi> k * of_nat k powr - s) \<longlonglongrightarrow> Dirichlet_L n \<chi> s

goal (1 subgoal):
 1. (\<lambda>m. sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<longlonglongrightarrow> sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - Dirichlet_L n \<chi> s
[PROOF STEP]
by (intro tendsto_intros)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<longlonglongrightarrow> sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - Dirichlet_L n \<chi> s

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. \<forall>\<^sub>F xa in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>xa. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. \<forall>\<^sub>F xa in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>xa. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
define M where "M = sum_upto \<chi>"
[PROOF STATE]
proof (state)
this:
M = sum_upto \<chi>

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. \<forall>\<^sub>F xa in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>xa. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have le: "norm (\<Sum>n\<in>real-`{x<..y}. \<chi> n * of_nat n powr - s)
              \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>" if xy: "0 < x" "x < y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
0 < x
x < y
[PROOF STEP]
have  I: "((\<lambda>t. M t * (-s * t powr (-s-1))) has_integral
                        M y * of_real y powr - s - M x * of_real x powr - s -
                       (\<Sum>n\<in>real-`{x<..y}. \<chi> n * of_real (real n) powr -s)) {x..y}"
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y

goal (1 subgoal):
 1. ((\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) has_integral M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s)) {x..y}
[PROOF STEP]
unfolding M_def
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y

goal (1 subgoal):
 1. ((\<lambda>t. sum_upto \<chi> t * (- s * complex_of_real t powr (- s - 1))) has_integral sum_upto \<chi> y * complex_of_real y powr - s - sum_upto \<chi> x * complex_of_real x powr - s - (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s)) {x..y}
[PROOF STEP]
by (intro partial_summation_strong [of "{}"])
         (auto intro!: has_vector_derivative_real_field derivative_eq_intros continuous_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) has_integral M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s)) {x..y}

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
hence "(\<Sum>n\<in>real-`{x<..y}. \<chi> n * real n powr -s) =
             M y * of_real y powr - s - M x * of_real x powr - s -
             integral {x..y} (\<lambda>t. M t * (-s * t powr (-s-1)))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) has_integral M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s)) {x..y}

goal (1 subgoal):
 1. (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s) = M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s) = M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s) = M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "norm \<dots> \<le> norm (M y * of_real y powr -s) + norm (M x * of_real x powr -s) +
                 norm (integral {x..y} (\<lambda>t. M t * (-s * t powr (-s-1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> cmod (M y * complex_of_real y powr - s) + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))))
[PROOF STEP]
by (intro order.trans[OF norm_triangle_ineq4] add_mono order.refl)
[PROOF STATE]
proof (state)
this:
cmod (M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> cmod (M y * complex_of_real y powr - s) + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (M y * complex_of_real y powr - s - M x * complex_of_real x powr - s - integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> cmod (M y * complex_of_real y powr - s) + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "norm (M y * of_real y powr -s) \<le> totient n * y powr -\<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (M y * complex_of_real y powr - s) \<le> real (totient n) * y powr - \<sigma>
[PROOF STEP]
using xy assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. cmod (M y * complex_of_real y powr - s) \<le> real (totient n) * y powr - \<sigma>
[PROOF STEP]
unfolding norm_mult M_def \<sigma>_def
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
Re s \<equiv> Re s

goal (1 subgoal):
 1. cmod (sum_upto \<chi> y) * cmod (complex_of_real y powr - s) \<le> real (totient n) * y powr - Re s
[PROOF STEP]
by (intro mult_mono sum_upto_dcharacter_le) (auto simp: norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
cmod (M y * complex_of_real y powr - s) \<le> real (totient n) * y powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (M y * complex_of_real y powr - s) \<le> real (totient n) * y powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "\<dots> \<le> totient n * x powr -\<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient n) * y powr - \<sigma> \<le> real (totient n) * x powr - \<sigma>
[PROOF STEP]
using assms xy
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
0 < x
x < y

goal (1 subgoal):
 1. real (totient n) * y powr - \<sigma> \<le> real (totient n) * x powr - \<sigma>
[PROOF STEP]
by (intro mult_left_mono powr_mono2') (auto simp: \<sigma>_def)
[PROOF STATE]
proof (state)
this:
real (totient n) * y powr - \<sigma> \<le> real (totient n) * x powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient n) * y powr - \<sigma> \<le> real (totient n) * x powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "norm (M x * of_real x powr -s) \<le> totient n * x powr -\<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (M x * complex_of_real x powr - s) \<le> real (totient n) * x powr - \<sigma>
[PROOF STEP]
using xy assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. cmod (M x * complex_of_real x powr - s) \<le> real (totient n) * x powr - \<sigma>
[PROOF STEP]
unfolding norm_mult M_def \<sigma>_def
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
Re s \<equiv> Re s

goal (1 subgoal):
 1. cmod (sum_upto \<chi> x) * cmod (complex_of_real x powr - s) \<le> real (totient n) * x powr - Re s
[PROOF STEP]
by (intro mult_mono sum_upto_dcharacter_le) (auto simp: norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
cmod (M x * complex_of_real x powr - s) \<le> real (totient n) * x powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (M x * complex_of_real x powr - s) \<le> real (totient n) * x powr - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "norm (integral {x..y} (\<lambda>t. M t * (- s * of_real t powr (-s-1)))) \<le>
                 integral {x..y} (\<lambda>t. real (totient n) * norm s * t powr (-\<sigma>-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1))
[PROOF STEP]
proof (rule integral_norm_bound_integral integrable_on_cmult_left)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) integrable_on {x..y}
 3. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
show "(\<lambda>t. real (totient n) * norm s * t powr (- \<sigma> - 1)) integrable_on {x..y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) integrable_on {x..y}
[PROOF STEP]
using xy
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y

goal (1 subgoal):
 1. (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) integrable_on {x..y}
[PROOF STEP]
by (intro integrable_continuous_real continuous_intros) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) integrable_on {x..y}

goal (2 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
assume t: "t \<in> {x..y}"
[PROOF STATE]
proof (state)
this:
t \<in> {x..y}

goal (2 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
have "norm (M t * (-s * of_real t powr (-s-1))) \<le>
              real (totient n) * (norm s * t powr (-\<sigma>-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (M t * (- s * complex_of_real t powr (- s - 1))) \<le> real (totient n) * (cmod s * t powr (- \<sigma> - 1))
[PROOF STEP]
unfolding norm_mult M_def \<sigma>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (sum_upto \<chi> t) * (cmod (- s) * cmod (complex_of_real t powr (- s - 1))) \<le> real (totient n) * (cmod s * t powr (- Re s - 1))
[PROOF STEP]
using xy t assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
t \<in> {x..y}
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. cmod (sum_upto \<chi> t) * (cmod (- s) * cmod (complex_of_real t powr (- s - 1))) \<le> real (totient n) * (cmod s * t powr (- Re s - 1))
[PROOF STEP]
by (intro mult_mono sum_upto_dcharacter_le) (auto simp: norm_mult norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
cmod (M t * (- s * complex_of_real t powr (- s - 1))) \<le> real (totient n) * (cmod s * t powr (- \<sigma> - 1))

goal (2 subgoals):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
 2. \<And>x. x \<in> {x..y} \<Longrightarrow> cmod (M x * (- s * complex_of_real x powr (- s - 1))) \<le> real (totient n) * cmod s * x powr (- \<sigma> - 1)
[PROOF STEP]
thus "norm (M t * (-s * of_real t powr (-s-1))) \<le> real (totient n) * norm s * t powr (-\<sigma>-1)"
[PROOF STATE]
proof (prove)
using this:
cmod (M t * (- s * complex_of_real t powr (- s - 1))) \<le> real (totient n) * (cmod s * t powr (- \<sigma> - 1))

goal (1 subgoal):
 1. cmod (M t * (- s * complex_of_real t powr (- s - 1))) \<le> real (totient n) * cmod s * t powr (- \<sigma> - 1)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
cmod (M t * (- s * complex_of_real t powr (- s - 1))) \<le> real (totient n) * cmod s * t powr (- \<sigma> - 1)

goal (1 subgoal):
 1. (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1))) integrable_on {x..y}
[PROOF STEP]
qed (insert I, auto simp: has_integral_iff)
[PROOF STATE]
proof (state)
this:
cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "\<dots> = real (totient n) * norm s * integral {x..y} (\<lambda>t. t powr (-\<sigma>-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) = real (totient n) * cmod s * integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) = real (totient n) * cmod s * integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {x..y} (\<lambda>t. real (totient n) * cmod s * t powr (- \<sigma> - 1)) = real (totient n) * cmod s * integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1))

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "((\<lambda>t. t powr (-\<sigma>-1)) has_integral (y powr -\<sigma> / (-\<sigma>) - x powr -\<sigma> / (-\<sigma>))) {x..y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. t powr (- \<sigma> - 1)) has_integral y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>) {x..y}
[PROOF STEP]
using xy assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. ((\<lambda>t. t powr (- \<sigma> - 1)) has_integral y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>) {x..y}
[PROOF STEP]
by (intro fundamental_theorem_of_calculus)
         (auto intro!: derivative_eq_intros
               simp: has_real_derivative_iff_has_vector_derivative [symmetric] \<sigma>_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. t powr (- \<sigma> - 1)) has_integral y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>) {x..y}

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
hence "integral {x..y} (\<lambda>t. t powr (-\<sigma>-1)) = y powr -\<sigma> / (-\<sigma>) - x powr -\<sigma> / (-\<sigma>)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. t powr (- \<sigma> - 1)) has_integral y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>) {x..y}

goal (1 subgoal):
 1. integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1)) = y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>
[PROOF STEP]
by (simp add: has_integral_iff)
[PROOF STATE]
proof (state)
this:
integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1)) = y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral {x..y} (\<lambda>t. t powr (- \<sigma> - 1)) = y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s
[PROOF STEP]
have "\<dots> \<le> x powr -\<sigma> / \<sigma>"
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> \<chi>\<^sub>0
0 < Re s
0 < x
\<sigma> \<equiv> Re s

goal (1 subgoal):
 1. y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma> \<le> x powr - \<sigma> / \<sigma>
[PROOF STEP]
by (simp add: \<sigma>_def)
[PROOF STATE]
proof (state)
this:
y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma> \<le> x powr - \<sigma> / \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y powr - \<sigma> / - \<sigma> - x powr - \<sigma> / - \<sigma> \<le> x powr - \<sigma> / \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "real (totient n) * x powr -\<sigma> + real (totient n) * x powr -\<sigma> +
                 real (totient n) * norm s * (x powr -\<sigma> / \<sigma>) =
               real (totient n) * (2 + norm s / \<sigma>) / x powr \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * (x powr - \<sigma> / \<sigma>) = real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
using xy
[PROOF STATE]
proof (prove)
using this:
0 < x
x < y

goal (1 subgoal):
 1. real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * (x powr - \<sigma> / \<sigma>) = real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
by (simp add: field_simps powr_minus)
[PROOF STATE]
proof (state)
this:
real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * (x powr - \<sigma> / \<sigma>) = real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>x ya. x \<le> ya \<Longrightarrow> x + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> ya + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x ya. x \<le> ya \<Longrightarrow> x + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> ya + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x ya. x \<le> ya \<Longrightarrow> real (totient n) * x powr - \<sigma> + x + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> real (totient n) * x powr - \<sigma> + ya + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x y. x \<le> y \<Longrightarrow> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + x \<le> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + y; \<And>x y. x \<le> y \<Longrightarrow> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * x \<le> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * y\<rbrakk> \<Longrightarrow> cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x ya. x \<le> ya \<Longrightarrow> x + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> ya + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x ya. x \<le> ya \<Longrightarrow> x + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> ya + cmod (M x * complex_of_real x powr - s) + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x ya. x \<le> ya \<Longrightarrow> real (totient n) * x powr - \<sigma> + x + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))) \<le> real (totient n) * x powr - \<sigma> + ya + cmod (integral {x..y} (\<lambda>t. M t * (- s * complex_of_real t powr (- s - 1)))); \<And>x y. x \<le> y \<Longrightarrow> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + x \<le> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + y; \<And>x y. x \<le> y \<Longrightarrow> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * x \<le> real (totient n) * x powr - \<sigma> + real (totient n) * x powr - \<sigma> + real (totient n) * cmod s * y\<rbrakk> \<Longrightarrow> cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * complex_of_real (real n) powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal (1 subgoal):
 1. cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
by (simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>n\<in>real -` {x<..y}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?x1; ?x1 < ?y1\<rbrakk> \<Longrightarrow> cmod (\<Sum>n\<in>real -` {?x1<..?y1}. \<chi> n * of_nat n powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / ?x1 powr \<sigma>

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. \<forall>\<^sub>F xa in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>xa. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
show "eventually (\<lambda>m. norm (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x -
                          (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s))
          \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F m in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
using eventually_gt_at_top[of "nat \<lfloor>x\<rfloor>"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) (nat \<lfloor>x\<rfloor>)) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F m in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
case (elim m)
[PROOF STATE]
proof (state)
this:
nat \<lfloor>x\<rfloor> < m

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "(\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x =
            (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x = (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s)
[PROOF STEP]
unfolding sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - (\<Sum>k\<in>{i. 0 < i \<and> real i \<le> x}. \<chi> k * of_nat k powr - s) = (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s)
[PROOF STEP]
using elim \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>x\<rfloor> < m
0 < x

goal (1 subgoal):
 1. (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - (\<Sum>k\<in>{i. 0 < i \<and> real i \<le> x}. \<chi> k * of_nat k powr - s) = (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s)
[PROOF STEP]
by (intro Groups_Big.sum_diff [symmetric])
                            (auto simp: nat_less_iff floor_less_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x = (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s)

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x = (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s)

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>{..m} - {k. real k \<le> x}. \<chi> k * of_nat k powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s) = (\<Sum>k\<in>{..m} - {k. real k \<le> x}. \<chi> k * of_nat k powr - s)
[PROOF STEP]
by (intro sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s) = (\<Sum>k\<in>{..m} - {k. real k \<le> x}. \<chi> k * of_nat k powr - s)

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{..m} - {k. 0 < k \<and> real k \<le> x}. \<chi> k * of_nat k powr - s) = (\<Sum>k\<in>{..m} - {k. real k \<le> x}. \<chi> k * of_nat k powr - s)

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "{..m} - {k. real k \<le> x} = real -` {x<..real m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..m} - {k. real k \<le> x} = real -` {x<..real m}
[PROOF STEP]
using elim \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>x\<rfloor> < m
0 < x

goal (1 subgoal):
 1. {..m} - {k. real k \<le> x} = real -` {x<..real m}
[PROOF STEP]
by (auto simp: nat_less_iff floor_less_iff not_less)
[PROOF STATE]
proof (state)
this:
{..m} - {k. real k \<le> x} = real -` {x<..real m}

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..m} - {k. real k \<le> x} = real -` {x<..real m}

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
have "norm (\<Sum>k\<in>\<dots>. \<chi> k * of_nat k powr -s) \<le>
                 real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (\<Sum>k\<in>real -` {x<..real m}. \<chi> k * of_nat k powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
using elim \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>x\<rfloor> < m
0 < x

goal (1 subgoal):
 1. cmod (\<Sum>k\<in>real -` {x<..real m}. \<chi> k * of_nat k powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
by (intro le) (auto simp: nat_less_iff floor_less_iff)
[PROOF STATE]
proof (state)
this:
cmod (\<Sum>k\<in>real -` {x<..real m}. \<chi> k * of_nat k powr - s) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal (1 subgoal):
 1. \<And>m. nat \<lfloor>x\<rfloor> < m \<Longrightarrow> cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod ((\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
cmod ((\<Sum>k\<le>m. \<chi> k * of_nat k powr - s) - sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal (1 subgoal):
 1. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>
[PROOF STEP]
by (simp add: norm_minus_commute)
[PROOF STATE]
proof (state)
this:
cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F m in sequentially. cmod (sum_upto (\<lambda>k. \<chi> k * of_nat k powr - s) x - (\<Sum>k\<le>m. \<chi> k * of_nat k powr - s)) \<le> real (totient n) * (2 + cmod s / \<sigma>) / x powr \<sigma>

goal (1 subgoal):
 1. sequentially \<noteq> bot
[PROOF STEP]
qed auto


[STATEMENT]
lemma SUP_ereal_minus_left:
  assumes "I \<noteq> {}" "c \<noteq> \<infinity>"
  shows "(SUP i\<in>I. f i - c:: ereal) = (SUP i\<in>I. f i) - c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>I. f i - c) = Sup (f ` I) - c
[PROOF STEP]
using SUP_ereal_add_left[OF \<open>I \<noteq> {}\<close>, of "-c" f]
[PROOF STATE]
proof (prove)
using this:
- c \<noteq> - \<infinity> \<Longrightarrow> (SUP i\<in>I. f i + - c) = Sup (f ` I) + - c

goal (1 subgoal):
 1. (SUP i\<in>I. f i - c) = Sup (f ` I) - c
[PROOF STEP]
by (simp add: \<open>c \<noteq> \<infinity>\<close> minus_ereal_def)


[STATEMENT]
lemma cos_tan: "\<bar>x\<bar> < pi/2 \<Longrightarrow> cos x = 1 / sqrt (1 + tan x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> < pi / 2 \<Longrightarrow> cos x = 1 / sqrt (1 + (tan x)\<^sup>2)
[PROOF STEP]
using cos_gt_zero_pi [of x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (pi / 2) < x; x < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos x

goal (1 subgoal):
 1. \<bar>x\<bar> < pi / 2 \<Longrightarrow> cos x = 1 / sqrt (1 + (tan x)\<^sup>2)
[PROOF STEP]
by (simp add: field_split_simps tan_def real_sqrt_divide abs_if split: if_split_asm)


[STATEMENT]
lemma (in group) ord_conv_Gcd: (* Manuel Eberl *)
  assumes "x \<in> carrier G"
  shows   "ord x = Gcd {n. x [^] n = \<one>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord x = Gcd {n. x [^] n = \<one>}
[PROOF STEP]
by (rule sym, rule Gcd_eqI) (use assms in \<open>auto simp: pow_eq_id\<close>)


[STATEMENT]
lemma real_of_ereal_inverse[simp]:
  fixes a :: ereal
  shows "real_of_ereal (inverse a) = 1 / real_of_ereal a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_ereal (inverse a) = 1 / real_of_ereal a
[PROOF STEP]
by (cases a) (auto simp: inverse_eq_divide)


[STATEMENT]
lemma floor_diff_of_int [simp]: "\<lfloor>x - of_int z\<rfloor> = \<lfloor>x\<rfloor> - z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x - of_int z\<rfloor> = \<lfloor>x\<rfloor> - z
[PROOF STEP]
using floor_add_int [of x "- z"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>x\<rfloor> + - z = \<lfloor>x + of_int (- z)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>x - of_int z\<rfloor> = \<lfloor>x\<rfloor> - z
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma (in -) concat_map_cons_rev:
  "rev (concat (map ((#) j) xss)) = concat (map (\<lambda> xs. xs @ [j]) (rev (map rev xss)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (concat (map ((#) j) xss)) = concat (map (\<lambda>xs. xs @ [j]) (rev (map rev xss)))
[PROOF STEP]
by (induction xss) auto


[STATEMENT]
lemma leadsTo_Trans:
     "[| F \<in> A leadsTo B;  F \<in> B leadsTo C |] ==> F \<in> A leadsTo C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A \<longmapsto> B; F \<in> B \<longmapsto> C\<rbrakk> \<Longrightarrow> F \<in> A \<longmapsto> C
[PROOF STEP]
apply (unfold leadsTo_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> {F. (A, B) \<in> leads F}; F \<in> {F. (B, C) \<in> leads F}\<rbrakk> \<Longrightarrow> F \<in> {F. (A, C) \<in> leads F}
[PROOF STEP]
apply (blast intro: leads.Trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wellformed_items_natUnion: "(\<And> k. wellformed_items (I k)) \<Longrightarrow> wellformed_items (natUnion I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. wellformed_items (I k)) \<Longrightarrow> wellformed_items (natUnion I)
[PROOF STEP]
by (auto simp add: natUnion_def wellformed_items_def)


[STATEMENT]
lemma eventually_atLeastAtMostD:
  fixes f l r :: "real \<Rightarrow> real"
  assumes "eventually (\<lambda>x. f x \<in> {l x..u x}) at_top"
  shows   "eventually (\<lambda>x. l x \<le> f x) at_top" "eventually (\<lambda>x. f x \<le> u x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. l x \<le> f x &&& \<forall>\<^sub>F x in at_top. f x \<le> u x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. f x \<in> {l x..u x}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. l x \<le> f x &&& \<forall>\<^sub>F x in at_top. f x \<le> u x
[PROOF STEP]
by (simp_all add: eventually_conj_iff)


[STATEMENT]
lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> interior S) = (\<exists>e>0. cball x e \<subseteq> S)
[PROOF STEP]
by (meson ball_subset_cball interior_subset mem_interior open_contains_cball open_interior
      subset_trans)


[STATEMENT]
lemma projecting_UN:
     "[| !!i. i \<in> I ==> projecting C h F (X' i) (X i) |]
      ==> projecting C h F (\<Union>i \<in> I. X' i) (\<Union>i \<in> I. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> projecting C h F (X' i) (X i)) \<Longrightarrow> projecting C h F (\<Union> (X' ` I)) (\<Union> (X ` I))
[PROOF STEP]
by (unfold projecting_def, blast)


[STATEMENT]
theorem euler_maclaurin_strong_int':
  assumes "a \<le> b"
  shows   "(\<Sum>k=a..b. f (of_int k)) =
             F (of_int b) + C + (1 / 2) *\<^sub>R f (of_int b) +
             (\<Sum>i=1..N. (bernoulli (2*i) / fact (2*i)) *\<^sub>R fs (2*i-1) (of_int b)) -
             EM_remainder (2*N+1) (fs (2*N+1)) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
have "(\<Sum>k=a..b. f (real_of_int k)) =
               F (of_int b) + C + (\<Sum>i<2*N+1. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (of_int b)) -
               EM_remainder (2*N+1) (fs (2*N+1)) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (\<Sum>i<2 * N + 1. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
by (rule euler_maclaurin_strong_int)
       (simp_all only: lessThan_Suc_atMost Suc_eq_plus1 [symmetric] assms)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (\<Sum>i<2 * N + 1. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (\<Sum>i<2 * N + 1. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
have "{..<2*N+1} = insert 0 {1..2*N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<2 * N + 1} = insert 0 {1..2 * N}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<2 * N + 1} = insert 0 {1..2 * N}

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..<2 * N + 1} = insert 0 {1..2 * N}

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
have "(\<Sum>i\<in>\<dots>. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (of_int b)) =
               (1 / 2) *\<^sub>R f (of_int b) +
               (\<Sum>i\<in>{1..2*N}. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (of_int b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>insert 0 {1..2 * N}. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b))
[PROOF STEP]
by (subst sum.insert) (auto simp: assms bernoulli'_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert 0 {1..2 * N}. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b))

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>insert 0 {1..2 * N}. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b))

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
have "(\<Sum>i\<in>{1..2*N}. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (of_int b)) =
               (\<Sum>i\<in>{1..N}. (bernoulli' (2*i) / fact (2*i)) *\<^sub>R fs (2*i-1) (of_int b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (\<Sum>i = 1..N. (bernoulli' (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))
[PROOF STEP]
proof (rule sym, rule sum.reindex_bij_witness_not_neutral)
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. finite ?S'2
 2. finite ?T'2
 3. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?i2 (?j2 a) = a
 4. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?j2 a \<in> {1..2 * N} - ?T'2
 5. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?j2 (?i2 b) = b
 6. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?i2 b \<in> {1..N} - ?S'2
 7. \<And>a. a \<in> ?S'2 \<Longrightarrow> (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b) = (0::'a)
 8. \<And>ba. ba \<in> ?T'2 \<Longrightarrow> (bernoulli' (Suc ba) / fact (Suc ba)) *\<^sub>R fs ba (real_of_int b) = (0::'a)
 9. \<And>a. a \<in> {1..N} \<Longrightarrow> (bernoulli' (Suc (?j2 a)) / fact (Suc (?j2 a))) *\<^sub>R fs (?j2 a) (real_of_int b) = (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (9 subgoals):
 1. finite ?S'2
 2. finite ?T'2
 3. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?i2 (?j2 a) = a
 4. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?j2 a \<in> {1..2 * N} - ?T'2
 5. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?j2 (?i2 b) = b
 6. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?i2 b \<in> {1..N} - ?S'2
 7. \<And>a. a \<in> ?S'2 \<Longrightarrow> (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b) = (0::'a)
 8. \<And>ba. ba \<in> ?T'2 \<Longrightarrow> (bernoulli' (Suc ba) / fact (Suc ba)) *\<^sub>R fs ba (real_of_int b) = (0::'a)
 9. \<And>a. a \<in> {1..N} \<Longrightarrow> (bernoulli' (Suc (?j2 a)) / fact (Suc (?j2 a))) *\<^sub>R fs (?j2 a) (real_of_int b) = (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b)
[PROOF STEP]
assume "i \<in> {1..2*N} - {i\<in>{1..2*N}. even i}"
[PROOF STATE]
proof (state)
this:
i \<in> {1..2 * N} - {i \<in> {1..2 * N}. even i}

goal (9 subgoals):
 1. finite ?S'2
 2. finite ?T'2
 3. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?i2 (?j2 a) = a
 4. \<And>a. a \<in> {1..N} - ?S'2 \<Longrightarrow> ?j2 a \<in> {1..2 * N} - ?T'2
 5. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?j2 (?i2 b) = b
 6. \<And>b. b \<in> {1..2 * N} - ?T'2 \<Longrightarrow> ?i2 b \<in> {1..N} - ?S'2
 7. \<And>a. a \<in> ?S'2 \<Longrightarrow> (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b) = (0::'a)
 8. \<And>ba. ba \<in> ?T'2 \<Longrightarrow> (bernoulli' (Suc ba) / fact (Suc ba)) *\<^sub>R fs ba (real_of_int b) = (0::'a)
 9. \<And>a. a \<in> {1..N} \<Longrightarrow> (bernoulli' (Suc (?j2 a)) / fact (Suc (?j2 a))) *\<^sub>R fs (?j2 a) (real_of_int b) = (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b)
[PROOF STEP]
thus "2 * ((i + 1) div 2) - 1 = i" "(i + 1) div 2 \<in> {1..N} - {}"
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..2 * N} - {i \<in> {1..2 * N}. even i}

goal (1 subgoal):
 1. 2 * ((i + 1) div 2) - 1 = i &&& (i + 1) div 2 \<in> {1..N} - {}
[PROOF STEP]
by (auto elim!: oddE)
[PROOF STATE]
proof (state)
this:
2 * ((i + 1) div 2) - 1 = i
(i + 1) div 2 \<in> {1..N} - {}

goal (7 subgoals):
 1. finite {}
 2. finite {i \<in> {1..2 * N}. even i}
 3. \<And>a. a \<in> {1..N} - {} \<Longrightarrow> (2 * a - 1 + 1) div 2 = a
 4. \<And>a. a \<in> {1..N} - {} \<Longrightarrow> 2 * a - 1 \<in> {1..2 * N} - {i \<in> {1..2 * N}. even i}
 5. \<And>a. a \<in> {} \<Longrightarrow> (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b) = (0::'a)
 6. \<And>ba. ba \<in> {i \<in> {1..2 * N}. even i} \<Longrightarrow> (bernoulli' (Suc ba) / fact (Suc ba)) *\<^sub>R fs ba (real_of_int b) = (0::'a)
 7. \<And>a. a \<in> {1..N} \<Longrightarrow> (bernoulli' (Suc (2 * a - 1)) / fact (Suc (2 * a - 1))) *\<^sub>R fs (2 * a - 1) (real_of_int b) = (bernoulli' (2 * a) / fact (2 * a)) *\<^sub>R fs (2 * a - 1) (real_of_int b)
[PROOF STEP]
qed (auto simp: bernoulli_odd_eq_0 bernoulli'_def algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (\<Sum>i = 1..N. (bernoulli' (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..2 * N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int b)) = (\<Sum>i = 1..N. (bernoulli' (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>{1..N}. (bernoulli (2*i) / fact (2*i)) *\<^sub>R fs (2*i-1) (of_int b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..N. (bernoulli' (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) = (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))
[PROOF STEP]
by (intro sum.cong refl) (auto simp: bernoulli'_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..N. (bernoulli' (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) = (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + ((1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + ((1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b))) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b

goal (1 subgoal):
 1. (\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b
[PROOF STEP]
by (simp only: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = a..b. f (real_of_int k)) = F (real_of_int b) + C + (1 / 2) *\<^sub>R f (real_of_int b) + (\<Sum>i = 1..N. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R fs (2 * i - 1) (real_of_int b)) - EM_remainder (2 * N + 1) (fs (2 * N + 1)) b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma combine_append:
  assumes "length Ks = length Us"
    and "set Ks  \<subseteq> carrier R" "set Us \<subseteq> carrier R"
    and "set Ks' \<subseteq> carrier R" "set Vs \<subseteq> carrier R"
  shows "(combine Ks Us) \<oplus> (combine Ks' Vs) = combine (Ks @ Ks') (Us @ Vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length Ks = length Us
set Ks \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs)
[PROOF STEP]
proof (induct Ks arbitrary: Us)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Us. \<lbrakk>length [] = length Us; set [] \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine [] Us \<oplus> combine Ks' Vs = combine ([] @ Ks') (Us @ Vs)
 2. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] = length Us
set [] \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (2 subgoals):
 1. \<And>Us. \<lbrakk>length [] = length Us; set [] \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine [] Us \<oplus> combine Ks' Vs = combine ([] @ Ks') (Us @ Vs)
 2. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length [] = length Us
set [] \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. combine [] Us \<oplus> combine Ks' Vs = combine ([] @ Ks') (Us @ Vs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
combine [] Us \<oplus> combine Ks' Vs = combine ([] @ Ks') (Us @ Vs)

goal (1 subgoal):
 1. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
case (Cons k Ks)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length Ks = length ?Us; set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks ?Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (?Us @ Vs)
length (k # Ks) = length Us
set (k # Ks) \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length Ks = length ?Us; set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks ?Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (?Us @ Vs)
length (k # Ks) = length Us
set (k # Ks) \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R
[PROOF STEP]
obtain u Us' where Us: "Us = u # Us'"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length Ks = length ?Us; set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks ?Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (?Us @ Vs)
length (k # Ks) = length Us
set (k # Ks) \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. (\<And>u Us'. Us = u # Us' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis length_Suc_conv)
[PROOF STATE]
proof (state)
this:
Us = u # Us'

goal (1 subgoal):
 1. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
hence u: "u \<in> carrier R" and Us': "set Us' \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
using this:
Us = u # Us'

goal (1 subgoal):
 1. u \<in> carrier R &&& set Us' \<subseteq> carrier R
[PROOF STEP]
using Cons(4)
[PROOF STATE]
proof (prove)
using this:
Us = u # Us'
set Us \<subseteq> carrier R

goal (1 subgoal):
 1. u \<in> carrier R &&& set Us' \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> carrier R
set Us' \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a Ks Us. \<lbrakk>\<And>Us. \<lbrakk>length Ks = length Us; set Ks \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (Us @ Vs); length (a # Ks) = length Us; set (a # Ks) \<subseteq> carrier R; set Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine (a # Ks) Us \<oplus> combine Ks' Vs = combine ((a # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> carrier R
set Us' \<subseteq> carrier R
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier R
set Us' \<subseteq> carrier R

goal (1 subgoal):
 1. combine (k # Ks) Us \<oplus> combine Ks' Vs = combine ((k # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
using combine_in_carrier[OF _ Us', of Ks] Cons
          combine_in_carrier[OF Cons(5-6)]
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier R
set Us' \<subseteq> carrier R
set Ks \<subseteq> carrier R \<Longrightarrow> combine Ks Us' \<in> carrier R
\<lbrakk>length Ks = length ?Us; set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks ?Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (?Us @ Vs)
length (k # Ks) = length Us
set (k # Ks) \<subseteq> carrier R
set Us \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R
combine Ks' Vs \<in> carrier R

goal (1 subgoal):
 1. combine (k # Ks) Us \<oplus> combine Ks' Vs = combine ((k # Ks) @ Ks') (Us @ Vs)
[PROOF STEP]
unfolding Us
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier R
set Us' \<subseteq> carrier R
set Ks \<subseteq> carrier R \<Longrightarrow> combine Ks Us' \<in> carrier R
\<lbrakk>length Ks = length ?Us; set Ks \<subseteq> carrier R; set ?Us \<subseteq> carrier R; set Ks' \<subseteq> carrier R; set Vs \<subseteq> carrier R\<rbrakk> \<Longrightarrow> combine Ks ?Us \<oplus> combine Ks' Vs = combine (Ks @ Ks') (?Us @ Vs)
length (k # Ks) = length (u # Us')
set (k # Ks) \<subseteq> carrier R
set (u # Us') \<subseteq> carrier R
set Ks' \<subseteq> carrier R
set Vs \<subseteq> carrier R
combine Ks' Vs \<in> carrier R

goal (1 subgoal):
 1. combine (k # Ks) (u # Us') \<oplus> combine Ks' Vs = combine ((k # Ks) @ Ks') ((u # Us') @ Vs)
[PROOF STEP]
by (auto, simp add: add.m_assoc)
[PROOF STATE]
proof (state)
this:
combine (k # Ks) Us \<oplus> combine Ks' Vs = combine ((k # Ks) @ Ks') (Us @ Vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_power_of_real [simp]:
  "nat_power n (of_real x :: 'a :: nat_power_normed_field) = of_real (real n powr x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_power n (of_real x) = of_real (real n powr x)
[PROOF STEP]
using nat_power_of_real_aux[of n x]
[PROOF STATE]
proof (prove)
using this:
nat_power n (x *\<^sub>R (1::?'a)) = real n powr x *\<^sub>R (1::?'a)

goal (1 subgoal):
 1. nat_power n (of_real x) = of_real (real n powr x)
[PROOF STEP]
by (simp add: scaleR_conv_of_real)


[STATEMENT]
lemma continuous_dist[continuous_intros]:
  fixes f g :: "_ \<Rightarrow> 'a :: metric_space"
  shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. dist (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. dist (f x) (g x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; (g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. dist (f x) (g x)) \<longlongrightarrow> dist (f (Lim F (\<lambda>x. x))) (g (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_dist)


[STATEMENT]
lemma measure_preserving_finite_measure:
  assumes "f \<in> measure_preserving M N"
  shows "finite_measure M \<longleftrightarrow> finite_measure N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_measure M = finite_measure N
[PROOF STEP]
using measure_preserving_total_measure[OF assms]
[PROOF STATE]
proof (prove)
using this:
emeasure M (space M) = emeasure N (space N)

goal (1 subgoal):
 1. finite_measure M = finite_measure N
[PROOF STEP]
by (metis finite_measure.emeasure_finite finite_measureI infinity_ennreal_def)


[STATEMENT]
lemma verts_reachable_connected:
  "verts G \<noteq> {} \<Longrightarrow> (\<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y) \<Longrightarrow> connected G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>verts G \<noteq> {}; \<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y\<rbrakk> \<Longrightarrow> Digraph_Component.connected G
[PROOF STEP]
by (simp add: connected_def strongly_connected_def reachable_mk_symmetricI)


[STATEMENT]
lemma iMin_mono_on: "
  \<lbrakk> mono_on f I; \<exists>x. x \<in> I \<rbrakk> \<Longrightarrow> iMin (f ` I) = f (iMin I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>SetInterval2.mono_on f I; \<exists>x. x \<in> I\<rbrakk> \<Longrightarrow> iMin (f ` I) = f (iMin I)
[PROOF STEP]
apply (unfold mono_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>I. \<forall>b\<in>I. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> I\<rbrakk> \<Longrightarrow> iMin (f ` I) = f (iMin I)
[PROOF STEP]
apply (rule iMin_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>a\<in>I. \<forall>b\<in>I. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> I\<rbrakk> \<Longrightarrow> f (iMin I) \<in> f ` I
 2. \<And>x. \<lbrakk>\<forall>a\<in>I. \<forall>b\<in>I. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> I; x \<in> f ` I\<rbrakk> \<Longrightarrow> f (iMin I) \<le> x
[PROOF STEP]
apply (blast intro: iMinI_ex)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma add_mult_distrib_mat[algebra_simps]: assumes m: "A \<in> carrier_mat nr n"
  "B \<in> carrier_mat nr n" "C \<in> carrier_mat n nc"
  shows "(A + B) * C = A * C + B * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) * C = A * C + B * C
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
B \<in> carrier_mat nr n
C \<in> carrier_mat n nc

goal (1 subgoal):
 1. (A + B) * C = A * C + B * C
[PROOF STEP]
by (intro eq_matI, auto simp: add_scalar_prod_distrib[of _ n])


[STATEMENT]
lemma content_subset: "cbox a b \<subseteq> cbox c d \<Longrightarrow> content (cbox a b) \<le> content (cbox c d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<subseteq> cbox c d \<Longrightarrow> content (cbox a b) \<le> content (cbox c d)
[PROOF STEP]
unfolding measure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<subseteq> cbox c d \<Longrightarrow> enn2real (emeasure lborel (cbox a b)) \<le> enn2real (emeasure lborel (cbox c d))
[PROOF STEP]
by (intro enn2real_mono emeasure_mono) (auto simp: emeasure_lborel_cbox_eq)


[STATEMENT]
lemma topspace_product_topology [simp]:
  "topspace (product_topology T I) = (\<Pi>\<^sub>E i\<in>I. topspace(T i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (product_topology T I) = (\<Pi>\<^sub>E i\<in>I. topspace (T i))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))
 2. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)
[PROOF STEP]
show "topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))
[PROOF STEP]
unfolding product_topology_def topology_generated_by_topspace
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}} \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))
[PROOF STEP]
unfolding topspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> \<Union> (Collect (openin (T i)))}} \<subseteq> (\<Pi>\<^sub>E i\<in>I. \<Union> (Collect (openin (T i))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)
[PROOF STEP]
have "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}
[PROOF STEP]
using openin_topspace not_finite_existsD
[PROOF STATE]
proof (prove)
using this:
openin ?U (topspace ?U)
infinite {a. ?P a} \<Longrightarrow> \<exists>a. ?P a

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}
[PROOF STEP]
show "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)"
[PROOF STATE]
proof (prove)
using this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)
[PROOF STEP]
unfolding product_topology_def
[PROOF STATE]
proof (prove)
using this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (topology_generated_by {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}})
[PROOF STEP]
using PiE_def
[PROOF STATE]
proof (prove)
using this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}
Pi\<^sub>E ?S ?T = Pi ?S ?T \<inter> extensional ?S

goal (1 subgoal):
 1. (\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (topology_generated_by {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}})
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordered_fmap_keys:
  assumes "is_fmap S"
  shows "map fst (ordered_fmap S) = sorted_list_of_fset (fst |`| S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map fst (ordered_fmap S) = sorted_list_of_fset (fst |`| S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_fmap S

goal (1 subgoal):
 1. map fst (ordered_fmap S) = sorted_list_of_fset (fst |`| S)
[PROOF STEP]
by transfer (rule ordered_map_keys)


[STATEMENT]
lemma sgn_rat [simp, code]: "sgn (Fract a b) = of_int (sgn a * sgn b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (Fract a b) = of_int (sgn a * sgn b)
[PROOF STEP]
unfolding Fract_of_int_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (Fract a b) = of_int (sgn a * sgn b)
[PROOF STEP]
by (auto simp: zsgn_def sgn_rat_def Zero_rat_def eq_rat)
    (auto simp: rat_number_collapse not_less le_less zero_less_mult_iff)


[STATEMENT]
lemma prefix_map_inj:
  "\<lbrakk> inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys) \<rbrakk> \<Longrightarrow>
   prefix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix xs ys
[PROOF STEP]
apply (induct xs arbitrary:ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>inj_on f (set [] \<union> set ys); prefix (map f []) (map f ys)\<rbrakk> \<Longrightarrow> prefix [] ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix xs ys; inj_on f (set (a # xs) \<union> set ys); prefix (map f (a # xs)) (map f ys)\<rbrakk> \<Longrightarrow> prefix (a # xs) ys
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix xs ys; inj_on f (set xs \<union> set ys) \<and> f a \<notin> f ` (set xs \<union> set ys - {a}); prefix (f a # map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix (a # xs) ys
[PROOF STEP]
apply (erule prefix_Cons_elim)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys ys'. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix xs ys; inj_on f (set xs \<union> set ys) \<and> f a \<notin> f ` (set xs \<union> set ys - {a}); map f ys = f a # ys'; prefix (map f xs) ys'\<rbrakk> \<Longrightarrow> prefix (a # xs) ys
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs z zs. \<lbrakk>\<And>ys. \<lbrakk>inj_on f (set xs \<union> set ys); prefix (map f xs) (map f ys)\<rbrakk> \<Longrightarrow> prefix xs ys; prefix (map f xs) (map f zs); f a \<notin> f ` (insert z (set xs \<union> set zs) - {a}); f z = f a; inj_on f (set xs \<union> set zs); f a \<notin> f ` (set xs \<union> set zs - {z})\<rbrakk> \<Longrightarrow> a = z
[PROOF STEP]
apply (metis image_insert insertI1 insert_Diff_if singletonE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_on_cong [cong]:
  "s = t \<Longrightarrow> (\<And>x. x \<in> t \<Longrightarrow> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s = t; \<And>x. x \<in> t \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> continuous_on s f = continuous_on t g
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s = t; \<And>x. x \<in> t \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> (\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)) = (\<forall>x\<in>t. (g \<longlongrightarrow> g x) (at x within t))
[PROOF STEP]
by (intro ball_cong filterlim_cong) (auto simp: eventually_at_filter)


[STATEMENT]
lemma not_before_in:
  "x : set xs \<Longrightarrow> y : set xs \<Longrightarrow> \<not> x < y in xs \<longleftrightarrow> y < x in xs \<or> x=y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> set xs; y \<in> set xs\<rbrakk> \<Longrightarrow> (\<not> x < y in xs) = (y < x in xs \<or> x = y)
[PROOF STEP]
by (metis index_eq_index_conv before_in_def less_asym linorder_neqE_nat)


[STATEMENT]
lemma underS_under:
assumes "i \<in> Field r"
shows "underS r i = under r i - {i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. underS r i = under r i - {i}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> Field r

goal (1 subgoal):
 1. underS r i = under r i - {i}
[PROOF STEP]
unfolding underS_def under_def
[PROOF STATE]
proof (prove)
using this:
i \<in> Field r

goal (1 subgoal):
 1. {b. b \<noteq> i \<and> (b, i) \<in> r} = {b. (b, i) \<in> r} - {i}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in abelian_group) a_card_cosets_equal:
     "\<lbrakk>c \<in> a_rcosets H;  H \<subseteq> carrier G; finite(carrier G)\<rbrakk>
      \<Longrightarrow> card c = card H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<in> a_rcosets H; H \<subseteq> carrier G; finite (carrier G)\<rbrakk> \<Longrightarrow> card c = card H
[PROOF STEP]
by (simp add: A_RCOSETS_defs(1) add.card_rcosets_equal)


[STATEMENT]
lemma vector_to_cblinfun_code[code]:
  \<comment> \<open>Code equation for translating a vector into an operation (single-column matrix)\<close>
  "mat_of_cblinfun (vector_to_cblinfun_code \<psi>) = mat_of_cols (CARD('a)) [vec_of_ell2 \<psi>]"
  for \<psi>::"'a::enum ell2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (vector_to_cblinfun_code \<psi>) = mat_of_cols CARD('a) [vec_of_ell2 \<psi>]
[PROOF STEP]
by (simp add: mat_of_cblinfun_vector_to_cblinfun  vec_of_ell2_def vector_to_cblinfun_code_def)


[STATEMENT]
lemma observable_io_targets_append :
  assumes "observable M"
  and "io_targets M q1 vs = {q2}"
  and "io_targets M q2 xs = {q3}"
shows "io_targets M q1 (vs@xs) = {q3}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
obtain trV where "path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>trV. path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(2) io_targets_elim singletonI)
[PROOF STATE]
proof (state)
this:
path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2

goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2

goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
obtain trX where "path M (xs || trX) q2 \<and> length trX = length xs
                              \<and> target (xs || trX) q2 = q3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>trX. path M (xs || trX) q2 \<and> length trX = length xs \<and> target (xs || trX) q2 = q3 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(3) io_targets_elim singletonI)
[PROOF STATE]
proof (state)
this:
path M (xs || trX) q2 \<and> length trX = length xs \<and> target (xs || trX) q2 = q3

goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2
path M (xs || trX) q2 \<and> length trX = length xs \<and> target (xs || trX) q2 = q3
[PROOF STEP]
have "path M (vs @ xs || trV @ trX) q1 \<and> length (trV @ trX) = length (vs @ xs)
                    \<and> target (vs @ xs || trV @ trX) q1 = q3"
[PROOF STATE]
proof (prove)
using this:
path M (vs || trV) q1 \<and> length trV = length vs \<and> target (vs || trV) q1 = q2
path M (xs || trX) q2 \<and> length trX = length xs \<and> target (xs || trX) q2 = q3

goal (1 subgoal):
 1. path M (vs @ xs || trV @ trX) q1 \<and> length (trV @ trX) = length (vs @ xs) \<and> target (vs @ xs || trV @ trX) q1 = q3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path M (vs @ xs || trV @ trX) q1 \<and> length (trV @ trX) = length (vs @ xs) \<and> target (vs @ xs || trV @ trX) q1 = q3

goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
path M (vs @ xs || trV @ trX) q1 \<and> length (trV @ trX) = length (vs @ xs) \<and> target (vs @ xs || trV @ trX) q1 = q3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path M (vs @ xs || trV @ trX) q1 \<and> length (trV @ trX) = length (vs @ xs) \<and> target (vs @ xs || trV @ trX) q1 = q3

goal (1 subgoal):
 1. io_targets M q1 (vs @ xs) = {q3}
[PROOF STEP]
by (metis assms(1) obs_target_is_io_targets)
[PROOF STATE]
proof (state)
this:
io_targets M q1 (vs @ xs) = {q3}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Log_le_zero_cancel_iff[simp]:
  "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> Log a x \<le> 0 \<longleftrightarrow> x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (Log a x \<le> 0) = (x \<le> 1)
[PROOF STEP]
using Log_le_cancel_iff[of a x 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < a; 0 < x; 0 < 1\<rbrakk> \<Longrightarrow> (Log a x \<le> Log a 1) = (x \<le> 1)

goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (Log a x \<le> 0) = (x \<le> 1)
[PROOF STEP]
by simp


[STATEMENT]
lemma expands_to_mult:
  "basis_wf basis \<Longrightarrow> (f expands_to F) basis \<Longrightarrow> (g expands_to G) basis \<Longrightarrow>
     ((\<lambda>x. f x * g x) expands_to F * G) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>basis_wf basis; (f expands_to F) basis; (g expands_to G) basis\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) expands_to F * G) basis
[PROOF STEP]
by (auto simp: expands_to.simps is_expansion_mult elim: eventually_elim2)


[STATEMENT]
lemma round_up_le1:
  assumes "x \<le> 1" "prec \<ge> 0"
  shows "round_up prec x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
have "real_of_int \<lceil>x * 2 powr prec\<rceil> \<le> real_of_int \<lceil>2 powr real_of_int prec\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> real_of_int \<lceil>2 powr real_of_int prec\<rceil>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> 1
0 \<le> prec

goal (1 subgoal):
 1. real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> real_of_int \<lceil>2 powr real_of_int prec\<rceil>
[PROOF STEP]
by (auto intro!: ceiling_mono)
[PROOF STATE]
proof (state)
this:
real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> real_of_int \<lceil>2 powr real_of_int prec\<rceil>

goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> real_of_int \<lceil>2 powr real_of_int prec\<rceil>

goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
have "\<dots> = 2 powr prec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lceil>2 powr real_of_int prec\<rceil> = 2 powr real_of_int prec
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<le> 1
0 \<le> prec

goal (1 subgoal):
 1. real_of_int \<lceil>2 powr real_of_int prec\<rceil> = 2 powr real_of_int prec
[PROOF STEP]
by (auto simp: powr_int intro!: exI[where x="2^nat prec"])
[PROOF STATE]
proof (state)
this:
real_of_int \<lceil>2 powr real_of_int prec\<rceil> = 2 powr real_of_int prec

goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> 2 powr real_of_int prec
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int \<lceil>x * 2 powr real_of_int prec\<rceil> \<le> 2 powr real_of_int prec

goal (1 subgoal):
 1. round_up prec x \<le> 1
[PROOF STEP]
by (simp add: round_up_def) (simp add: powr_minus inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
round_up prec x \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_of_basis_enum_inverse[simp]:
  fixes w::"'a::basis_enum"
  shows  "basis_enum_of_vec (vec_of_basis_enum w) = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (vec_of_basis_enum w) = w
[PROOF STEP]
unfolding vec_of_basis_enum_def basis_enum_of_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dim_vec (vec_of_list (map (crepresentation (set canonical_basis) w) canonical_basis)) = length canonical_basis then sum_list (map2 (*\<^sub>C) (list_of_vec (vec_of_list (map (crepresentation (set canonical_basis) w) canonical_basis))) canonical_basis) else (0::'a)) = w
[PROOF STEP]
unfolding list_vec zip_map1 zip_same_conv_map map_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dim_vec (vec_of_list (map (crepresentation (set canonical_basis) w) canonical_basis)) = length canonical_basis then sum_list (map ((\<lambda>(x, y). x *\<^sub>C y) \<circ> ((\<lambda>(x, y). (crepresentation (set canonical_basis) w x, y)) \<circ> (\<lambda>x. (x, x)))) canonical_basis) else (0::'a)) = w
[PROOF STEP]
apply (simp add: o_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>canonical_basis. crepresentation (set canonical_basis) w x *\<^sub>C x) = w
[PROOF STEP]
apply (subst sum.distinct_set_conv_list[symmetric], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set canonical_basis. crepresentation (set canonical_basis) w x *\<^sub>C x) = w
[PROOF STEP]
apply (rule complex_vector.sum_representation_eq)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. cindependent (set canonical_basis)
 2. w \<in> cspan (set canonical_basis)
 3. finite (set canonical_basis)
 4. set canonical_basis \<subseteq> set canonical_basis
[PROOF STEP]
using  is_generator_set
[PROOF STATE]
proof (prove)
using this:
cspan (set canonical_basis) = UNIV

goal (4 subgoals):
 1. cindependent (set canonical_basis)
 2. w \<in> cspan (set canonical_basis)
 3. finite (set canonical_basis)
 4. set canonical_basis \<subseteq> set canonical_basis
[PROOF STEP]
by auto


[STATEMENT]
theorem sylow_contained_in_sylow_group:
  assumes H:"H \<in> subgroups_of_size (p ^ b)"
  obtains S where "H \<subseteq> S" and "S \<in> subgroups_of_size (p ^ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from H
[PROOF STATE]
proof (chain)
picking this:
H \<in> subgroups_of_size (p ^ b)
[PROOF STEP]
have HG:"H \<subseteq> carrier G"
[PROOF STATE]
proof (prove)
using this:
H \<in> subgroups_of_size (p ^ b)

goal (1 subgoal):
 1. H \<subseteq> carrier G
[PROOF STEP]
unfolding subgroups_of_size_def
[PROOF STATE]
proof (prove)
using this:
H \<in> {H. subgroup H G \<and> card H = p ^ b}

goal (1 subgoal):
 1. H \<subseteq> carrier G
[PROOF STEP]
by (simp add:subgroup.subset)
[PROOF STATE]
proof (state)
this:
H \<subseteq> carrier G

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain P where PG:"subgroup P G" and cardP:"card P = p ^ a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. \<lbrakk>subgroup P G; card P = p ^ a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis sylow_thm)
[PROOF STATE]
proof (state)
this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
hence Psize:"P \<in> subgroups_of_size (p ^ a)"
[PROOF STATE]
proof (prove)
using this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
unfolding subgroups_of_size_def
[PROOF STATE]
proof (prove)
using this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. P \<in> {H. subgroup H G \<and> card H = p ^ a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with H
[PROOF STATE]
proof (chain)
picking this:
H \<in> subgroups_of_size (p ^ b)
P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
obtain g where g:"g \<in> carrier G" "H \<subseteq> g <# (P #> inv g)"
[PROOF STATE]
proof (prove)
using this:
H \<in> subgroups_of_size (p ^ b)
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g \<in> carrier G; H \<subseteq> g <# (P #> inv g)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis ex_conj_sylow_group)
[PROOF STATE]
proof (state)
this:
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
note Psize g
[PROOF STATE]
proof (state)
this:
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with finite_G
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
[PROOF STEP]
have "conjugation_action (p ^ a) g P \<in> subgroups_of_size (p ^ a)"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)

goal (1 subgoal):
 1. conjugation_action (p ^ a) g P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
by (metis conjugation_is_size_invariant)
[PROOF STATE]
proof (state)
this:
conjugation_action (p ^ a) g P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>H \<subseteq> S; S \<in> subgroups_of_size (p ^ a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
conjugation_action (p ^ a) g P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
conjugation_action (p ^ a) g P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
unfolding conjugation_action_def
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
P \<in> subgroups_of_size (p ^ a)
g \<in> carrier G
H \<subseteq> g <# (P #> inv g)
(\<lambda>g\<in>carrier G. \<lambda>P\<in>subgroups_of_size (p ^ a). g <# (P #> inv g)) g P \<in> subgroups_of_size (p ^ a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gamma_one_half_real: "Gamma (1/2 :: real) = sqrt pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
from Gamma_reflection_complex[of "1/2"] fraction_not_in_ints[where 'a = complex, of 2 1]
[PROOF STATE]
proof (chain)
picking this:
Gamma (1 / 2) * Gamma (1 - 1 / 2) = complex_of_real pi / sin (complex_of_real pi * (1 / 2))
\<lbrakk>\<not> is_unit 2; 2 \<noteq> 0\<rbrakk> \<Longrightarrow> of_int 1 / of_int 2 \<notin> \<int>
[PROOF STEP]
have "Gamma (1/2 :: complex)^2 = of_real pi"
[PROOF STATE]
proof (prove)
using this:
Gamma (1 / 2) * Gamma (1 - 1 / 2) = complex_of_real pi / sin (complex_of_real pi * (1 / 2))
\<lbrakk>\<not> is_unit 2; 2 \<noteq> 0\<rbrakk> \<Longrightarrow> of_int 1 / of_int 2 \<notin> \<int>

goal (1 subgoal):
 1. (Gamma (1 / 2))\<^sup>2 = complex_of_real pi
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(Gamma (1 / 2))\<^sup>2 = complex_of_real pi

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
hence "of_real pi = Gamma (complex_of_real (1/2))^2"
[PROOF STATE]
proof (prove)
using this:
(Gamma (1 / 2))\<^sup>2 = complex_of_real pi

goal (1 subgoal):
 1. complex_of_real pi = (Gamma (complex_of_real (1 / 2)))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
complex_of_real pi = (Gamma (complex_of_real (1 / 2)))\<^sup>2

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real pi = (Gamma (complex_of_real (1 / 2)))\<^sup>2

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
have "\<dots> = of_real ((Gamma (1/2))^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gamma (complex_of_real (1 / 2)))\<^sup>2 = complex_of_real ((Gamma (1 / 2))\<^sup>2)
[PROOF STEP]
by (subst Gamma_complex_of_real) simp_all
[PROOF STATE]
proof (state)
this:
(Gamma (complex_of_real (1 / 2)))\<^sup>2 = complex_of_real ((Gamma (1 / 2))\<^sup>2)

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real pi = complex_of_real ((Gamma (1 / 2))\<^sup>2)
[PROOF STEP]
have "Gamma (1/2)^2 = pi"
[PROOF STATE]
proof (prove)
using this:
complex_of_real pi = complex_of_real ((Gamma (1 / 2))\<^sup>2)

goal (1 subgoal):
 1. (Gamma (1 / 2))\<^sup>2 = pi
[PROOF STEP]
by (subst (asm) of_real_eq_iff) simp_all
[PROOF STATE]
proof (state)
this:
(Gamma (1 / 2))\<^sup>2 = pi

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(Gamma (1 / 2))\<^sup>2 = pi

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
have "Gamma (1/2 :: real) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Gamma (1 / 2)
[PROOF STEP]
using Gamma_real_pos[of "1/2"]
[PROOF STATE]
proof (prove)
using this:
0 < 1 / 2 \<Longrightarrow> 0 < Gamma (1 / 2)

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

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(Gamma (1 / 2))\<^sup>2 = pi
0 \<le> Gamma (1 / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Gamma (1 / 2))\<^sup>2 = pi
0 \<le> Gamma (1 / 2)

goal (1 subgoal):
 1. Gamma (1 / 2) = sqrt pi
[PROOF STEP]
by (rule real_sqrt_unique [symmetric])
[PROOF STATE]
proof (state)
this:
Gamma (1 / 2) = sqrt pi

goal:
No subgoals!
[PROOF STEP]
qed