[STATEMENT]
lemma foldr_foldr_concat: "foldr (foldr f) m a = foldr f (concat m) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (foldr f) m a = foldr f (concat m) a
[PROOF STEP]
proof (induct m arbitrary: a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. foldr (foldr f) [] a = foldr f (concat []) a
 2. \<And>a m aa. (\<And>a. foldr (foldr f) m a = foldr f (concat m) a) \<Longrightarrow> foldr (foldr f) (a # m) aa = foldr f (concat (a # m)) aa
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a. foldr (foldr f) [] a = foldr f (concat []) a
 2. \<And>a m aa. (\<And>a. foldr (foldr f) m a = foldr f (concat m) a) \<Longrightarrow> foldr (foldr f) (a # m) aa = foldr f (concat (a # m)) aa
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (foldr f) [] a = foldr f (concat []) a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldr (foldr f) [] a = foldr f (concat []) a

goal (1 subgoal):
 1. \<And>a m aa. (\<And>a. foldr (foldr f) m a = foldr f (concat m) a) \<Longrightarrow> foldr (foldr f) (a # m) aa = foldr f (concat (a # m)) aa
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m aa. (\<And>a. foldr (foldr f) m a = foldr f (concat m) a) \<Longrightarrow> foldr (foldr f) (a # m) aa = foldr f (concat (a # m)) aa
[PROOF STEP]
case (Cons v m a)
[PROOF STATE]
proof (state)
this:
foldr (foldr f) m ?a = foldr f (concat m) ?a

goal (1 subgoal):
 1. \<And>a m aa. (\<And>a. foldr (foldr f) m a = foldr f (concat m) a) \<Longrightarrow> foldr (foldr f) (a # m) aa = foldr f (concat (a # m)) aa
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (foldr f) (v # m) a = foldr f (concat (v # m)) a
[PROOF STEP]
unfolding concat.simps foldr_Cons o_def Cons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr f v (foldr f (concat m) a) = foldr f (v @ concat m) a
[PROOF STEP]
unfolding foldr_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr f v (foldr f (concat m) a) = foldr f v (foldr f (concat m) a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldr (foldr f) (v # m) a = foldr f (concat (v # m)) a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_bound_simple_function:
  assumes bnd: "\<And>x. x \<in> space M \<Longrightarrow> f x < \<infinity>"
  assumes f[measurable]: "simple_function M f"
  assumes supp: "emeasure M {x\<in>space M. f x \<noteq> 0} < \<infinity>"
  shows "nn_integral M f < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N M f < \<infinity>
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
assume "space M = {}"
[PROOF STATE]
proof (state)
this:
space M = {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
space M = {}
[PROOF STEP]
have "nn_integral M f = (\<integral>\<^sup>+x. 0 \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
space M = {}

goal (1 subgoal):
 1. integral\<^sup>N M f = \<integral>\<^sup>+ x. 0 \<partial>M
[PROOF STEP]
by (intro nn_integral_cong) auto
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. 0 \<partial>M

goal (2 subgoals):
 1. ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
 2. \<not> ?P \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. 0 \<partial>M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N M f = \<integral>\<^sup>+ x. 0 \<partial>M

goal (1 subgoal):
 1. integral\<^sup>N M f < \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f < \<infinity>

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
assume "space M \<noteq> {}"
[PROOF STATE]
proof (state)
this:
space M \<noteq> {}

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
with simple_functionD(1)[OF f] bnd
[PROOF STATE]
proof (chain)
picking this:
finite (f ` space M)
?x \<in> space M \<Longrightarrow> f ?x < \<infinity>
space M \<noteq> {}
[PROOF STEP]
have bnd: "0 \<le> Max (f`space M) \<and> Max (f`space M) < \<infinity>"
[PROOF STATE]
proof (prove)
using this:
finite (f ` space M)
?x \<in> space M \<Longrightarrow> f ?x < \<infinity>
space M \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> Max (f ` space M) \<and> Max (f ` space M) < \<infinity>
[PROOF STEP]
by (subst Max_less_iff) (auto simp: Max_ge_iff)
[PROOF STATE]
proof (state)
this:
0 \<le> Max (f ` space M) \<and> Max (f ` space M) < \<infinity>

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
have "nn_integral M f \<le> (\<integral>\<^sup>+x. Max (f`space M) * indicator {x\<in>space M. f x \<noteq> 0} x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N M f \<le> \<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M
[PROOF STEP]
proof (rule nn_integral_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x
[PROOF STEP]
assume "x \<in> space M"
[PROOF STATE]
proof (state)
this:
x \<in> space M

goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
simple_function M f
x \<in> space M
[PROOF STEP]
show "f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x"
[PROOF STATE]
proof (prove)
using this:
simple_function M f
x \<in> space M

goal (1 subgoal):
 1. f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x
[PROOF STEP]
by (auto split: split_indicator intro!: Max_ge simple_functionD)
[PROOF STATE]
proof (state)
this:
f x \<le> Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f \<le> \<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f \<le> \<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
have "\<dots> < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M < \<infinity>
[PROOF STEP]
using bnd supp
[PROOF STATE]
proof (prove)
using this:
0 \<le> Max (f ` space M) \<and> Max (f ` space M) < \<infinity>
emeasure M {x \<in> space M. f x \<noteq> 0} < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M < \<infinity>
[PROOF STEP]
by (subst nn_integral_cmult) (auto simp: ennreal_mult_less_top)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. Max (f ` space M) * indicator {x \<in> space M. f x \<noteq> 0} x \<partial>M < \<infinity>

goal (1 subgoal):
 1. space M \<noteq> {} \<Longrightarrow> integral\<^sup>N M f < \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>N M f < \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>N M f < \<infinity>

goal (1 subgoal):
 1. integral\<^sup>N M f < \<infinity>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f < \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unit_factor_Lcm: "unit_factor (Lcm A) = (if Lcm A = 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
proof (cases "Lcm A = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Lcm A = (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
 2. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Lcm A = (0::'a)

goal (2 subgoals):
 1. Lcm A = (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
 2. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Lcm A = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Lcm A = (0::'a)

goal (1 subgoal):
 1. unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))

goal (1 subgoal):
 1. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Lcm A \<noteq> (0::'a)

goal (1 subgoal):
 1. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
with unit_factor_normalize
[PROOF STATE]
proof (chain)
picking this:
?a \<noteq> (0::'a) \<Longrightarrow> unit_factor (normalize ?a) = (1::'a)
Lcm A \<noteq> (0::'a)
[PROOF STEP]
have "unit_factor (normalize (Lcm A)) = 1"
[PROOF STATE]
proof (prove)
using this:
?a \<noteq> (0::'a) \<Longrightarrow> unit_factor (normalize ?a) = (1::'a)
Lcm A \<noteq> (0::'a)

goal (1 subgoal):
 1. unit_factor (normalize (Lcm A)) = (1::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
unit_factor (normalize (Lcm A)) = (1::'a)

goal (1 subgoal):
 1. Lcm A \<noteq> (0::'a) \<Longrightarrow> unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
Lcm A \<noteq> (0::'a)
unit_factor (normalize (Lcm A)) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Lcm A \<noteq> (0::'a)
unit_factor (normalize (Lcm A)) = (1::'a)

goal (1 subgoal):
 1. unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_factor (Lcm A) = (if Lcm A = (0::'a) then 0::'a else (1::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma erf_of_real [simp]: "erf (of_real x) = of_real (erf x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf (of_real x) = of_real (erf x)
[PROOF STEP]
unfolding erf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. of_real (erf_coeffs n) * of_real x ^ n) = of_real (\<Sum>n. of_real (erf_coeffs n) * x ^ n)
[PROOF STEP]
using summable_erf[of x]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. of_real (erf_coeffs n) * x ^ n)

goal (1 subgoal):
 1. (\<Sum>n. of_real (erf_coeffs n) * of_real x ^ n) = of_real (\<Sum>n. of_real (erf_coeffs n) * x ^ n)
[PROOF STEP]
by (subst suminf_of_real) (simp_all add: summable_erf)


[STATEMENT]
lemma orthogonal_projectors_orthogonal_spaces:
  \<comment> \<open>Logically belongs in section "Projectors".\<close>
  fixes S T :: \<open>'a::chilbert_space ccsubspace\<close>
  shows \<open>orthogonal_spaces S T \<longleftrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_spaces S T = (Proj S o\<^sub>C\<^sub>L Proj T = 0)
[PROOF STEP]
proof (intro ballI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
 2. Proj S o\<^sub>C\<^sub>L Proj T = 0 \<Longrightarrow> orthogonal_spaces S T
[PROOF STEP]
assume \<open>Proj S o\<^sub>C\<^sub>L Proj T = 0\<close>
[PROOF STATE]
proof (state)
this:
Proj S o\<^sub>C\<^sub>L Proj T = 0

goal (2 subgoals):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
 2. Proj S o\<^sub>C\<^sub>L Proj T = 0 \<Longrightarrow> orthogonal_spaces S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
have \<open>is_orthogonal x y\<close> if \<open>x \<in> space_as_set S\<close> \<open>y \<in> space_as_set T\<close> for x y
[PROOF STATE]
proof (prove)
using this:
Proj S o\<^sub>C\<^sub>L Proj T = 0

goal (1 subgoal):
 1. is_orthogonal x y
[PROOF STEP]
by (metis (no_types, opaque_lifting) Proj_fixes_image adj_Proj cblinfun.zero_left cblinfun_apply_cblinfun_compose cinner_adj_right cinner_zero_right that(1) that(2))
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> space_as_set S; ?y \<in> space_as_set T\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y

goal (2 subgoals):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
 2. Proj S o\<^sub>C\<^sub>L Proj T = 0 \<Longrightarrow> orthogonal_spaces S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> space_as_set S; ?y \<in> space_as_set T\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
[PROOF STEP]
show \<open>orthogonal_spaces S T\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> space_as_set S; ?y \<in> space_as_set T\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y

goal (1 subgoal):
 1. orthogonal_spaces S T
[PROOF STEP]
by (simp add: orthogonal_spaces_def)
[PROOF STATE]
proof (state)
this:
orthogonal_spaces S T

goal (1 subgoal):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
assume \<open>orthogonal_spaces S T\<close>
[PROOF STATE]
proof (state)
this:
orthogonal_spaces S T

goal (1 subgoal):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
orthogonal_spaces S T
[PROOF STEP]
have \<open>S \<le> - T\<close>
[PROOF STATE]
proof (prove)
using this:
orthogonal_spaces S T

goal (1 subgoal):
 1. S \<le> - T
[PROOF STEP]
by (simp add: orthogonal_spaces_leq_compl)
[PROOF STATE]
proof (state)
this:
S \<le> - T

goal (1 subgoal):
 1. orthogonal_spaces S T \<Longrightarrow> Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<le> - T
[PROOF STEP]
show \<open>Proj S o\<^sub>C\<^sub>L Proj T = 0\<close>
[PROOF STATE]
proof (prove)
using this:
S \<le> - T

goal (1 subgoal):
 1. Proj S o\<^sub>C\<^sub>L Proj T = 0
[PROOF STEP]
by (metis (no_types, opaque_lifting) Proj_range adj_Proj adj_cblinfun_compose basic_trans_rules(31) cblinfun.zero_left cblinfun_apply_cblinfun_compose cblinfun_apply_in_image cblinfun_eqI kernel_Proj kernel_memberD less_eq_ccsubspace.rep_eq)
[PROOF STATE]
proof (state)
this:
Proj S o\<^sub>C\<^sub>L Proj T = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Inf_UNIV_nat: "(Inf UNIV :: nat) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf UNIV = 0
[PROOF STEP]
by (simp add: cInf_eq_minimum)


[STATEMENT]
lemma birkhoff_sum_abs:
  fixes f::"_ \<Rightarrow> 'b::real_normed_vector"
  shows "norm(birkhoff_sum f n x) \<le> birkhoff_sum (\<lambda>x. norm(f x)) n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (birkhoff_sum f n x) \<le> birkhoff_sum (\<lambda>x. norm (f x)) n x
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>i<n. f ((T ^^ i) x)) \<le> (\<Sum>i<n. norm (f ((T ^^ i) x)))
[PROOF STEP]
using norm_sum
[PROOF STATE]
proof (prove)
using this:
norm (sum ?f ?A) \<le> (\<Sum>i\<in>?A. norm (?f i))

goal (1 subgoal):
 1. norm (\<Sum>i<n. f ((T ^^ i) x)) \<le> (\<Sum>i<n. norm (f ((T ^^ i) x)))
[PROOF STEP]
by auto


[STATEMENT]
lemma padic_int_simps:
 "\<one>\<^bsub>padic_int p\<^esub> = padic_one p"
 "\<zero>\<^bsub>padic_int p\<^esub> = padic_zero p"
 "(\<oplus>\<^bsub>padic_int p\<^esub>) = padic_add p"
 "(\<otimes>\<^bsub>padic_int p\<^esub>) = padic_mult p"
 "carrier (padic_int p) = padic_set p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<one>\<^bsub>padic_int p\<^esub> = padic_one p &&& \<zero>\<^bsub>padic_int p\<^esub> = padic_zero p) &&& (\<oplus>\<^bsub>padic_int p\<^esub>) = padic_add p &&& (\<otimes>\<^bsub>padic_int p\<^esub>) = padic_mult p &&& carrier (padic_int p) = padic_set p
[PROOF STEP]
unfolding padic_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<one>\<^bsub>\<lparr>carrier = padic_set p, monoid.mult = padic_mult p, one = padic_one p, zero = padic_zero p, add = padic_add p\<rparr>\<^esub> = padic_one p &&& \<zero>\<^bsub>\<lparr>carrier = padic_set p, monoid.mult = padic_mult p, one = padic_one p, zero = padic_zero p, add = padic_add p\<rparr>\<^esub> = padic_zero p) &&& (\<oplus>\<^bsub>\<lparr>carrier = padic_set p, monoid.mult = padic_mult p, one = padic_one p, zero = padic_zero p, add = padic_add p\<rparr>\<^esub>) = padic_add p &&& (\<otimes>\<^bsub>\<lparr>carrier = padic_set p, monoid.mult = padic_mult p, one = padic_one p, zero = padic_zero p, add = padic_add p\<rparr>\<^esub>) = padic_mult p &&& carrier \<lparr>carrier = padic_set p, monoid.mult = padic_mult p, one = padic_one p, zero = padic_zero p, add = padic_add p\<rparr> = padic_set p
[PROOF STEP]
by auto


[STATEMENT]
lemma set_of_plus:
  fixes A :: "'a::linordered_ab_group_add interval"
  shows "set_of (A + B) = set_of A + set_of B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (A + B) = set_of A + set_of B
[PROOF STEP]
using Icc_plus_Icc[of "lower A" "upper A" "lower B" "upper B"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>lower A \<le> upper A; lower B \<le> upper B\<rbrakk> \<Longrightarrow> {lower A..upper A} + {lower B..upper B} = {lower A + lower B..upper A + upper B}

goal (1 subgoal):
 1. set_of (A + B) = set_of A + set_of B
[PROOF STEP]
by (auto simp: set_of_eq)


[STATEMENT]
theorem integer_partitions_cardinality:
  "card (integer_partitions n) = Partition (2*n) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (integer_partitions n) = Partition (2 * n) n
[PROOF STEP]
using integer_partitions_cardinality_aux Partition_sum_Partition_diff add_implies_diff le_add1 mult_2
[PROOF STATE]
proof (prove)
using this:
card (integer_partitions ?n) = sum (Partition ?n) {..?n}
?k \<le> ?m \<Longrightarrow> Partition ?m ?k = sum (Partition (?m - ?k)) {..?k}
?c + ?b = ?a \<Longrightarrow> ?c = ?a - ?b
?n \<le> ?n + ?m
(2::?'a) * ?z = ?z + ?z

goal (1 subgoal):
 1. card (integer_partitions n) = Partition (2 * n) n
[PROOF STEP]
by simp


[STATEMENT]
lemma X_XpZ_rho_psim[simp]:
  shows "Complex_Matrix.trace (rho_psim * X_XpZ) =1/ (sqrt 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rho_psim * X_XpZ) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
apply (auto simp add: rho_psim_def ket_psim_def ket_10_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v (ket_01 - (ket_1 \<otimes> ket_0))) * X_XpZ) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: X_XpZ_def Z_def XpZ_def X_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rank_1_proj (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v (ket_01 - (ket_1 \<otimes> ket_0))) * (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) \<Otimes> - (1 / complex_of_real (sqrt 2)) \<cdot>\<^sub>m (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) + Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: rank_1_proj_def outer_prod_def ket_01_def ket_1_def ket_0_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (Matrix.mat 4 (Suc 0) (\<lambda>(i, j). (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ i) * Matrix.mat (Suc 0) 4 (\<lambda>(i, j). conjugate (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ j) * (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) \<Otimes> - (1 / complex_of_real (sqrt 2)) \<cdot>\<^sub>m (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) + Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: Complex_Matrix.trace_def sum_4_elems)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / (complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * complex_of_real (sqrt 2))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (simp add: csqrt_2_sq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma minus_smult_vec_distrib:
  fixes w :: "'a::comm_ring_1 vec"
  shows "(a - b) \<cdot>\<^sub>v w = a \<cdot>\<^sub>v w - b \<cdot>\<^sub>v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) \<cdot>\<^sub>v w = a \<cdot>\<^sub>v w - b \<cdot>\<^sub>v w
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (a \<cdot>\<^sub>v w - b \<cdot>\<^sub>v w) \<Longrightarrow> ((a - b) \<cdot>\<^sub>v w) $ i = (a \<cdot>\<^sub>v w - b \<cdot>\<^sub>v w) $ i
 2. dim_vec ((a - b) \<cdot>\<^sub>v w) = dim_vec (a \<cdot>\<^sub>v w - b \<cdot>\<^sub>v w)
[PROOF STEP]
by (auto simp add: scalar_prod_def algebra_simps)


[STATEMENT]
lemma sin_cos_eq:
  fixes a b :: real
  assumes "cos a = cos b" and "sin a = sin b"
  shows "\<exists> k::int. a - b = 2*k*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. a - b = 2 * real_of_int x * pi
[PROOF STEP]
by (metis assms cos_diff cos_one_2pi_int mult.commute sin_cos_squared_add3)


[STATEMENT]
lemma card_surjective_functions_domain_permutation:
  assumes "finite A" "finite B"
  assumes "card B \<le> card A"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = (card A - 1) choose (card A - card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
let ?FSet = "{f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B"
  and ?MSet = "{M. set_mset M = B \<and> size M = card A}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
have "bij_betw (msubset_of A) ?FSet ?MSet"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (msubset_of A) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) {M. set_mset M = B \<and> size M = card A}
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. bij_betw (msubset_of A) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) {M. set_mset M = B \<and> size M = card A}
[PROOF STEP]
by (rule bij_betw_msubset_of)
[PROOF STATE]
proof (state)
this:
bij_betw (msubset_of A) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) {M. set_mset M = B \<and> size M = card A}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw (msubset_of A) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) {M. set_mset M = B \<and> size M = card A}
[PROOF STEP]
have "card ?FSet = card ?MSet"
[PROOF STATE]
proof (prove)
using this:
bij_betw (msubset_of A) ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) {M. set_mset M = B \<and> size M = card A}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card {M. set_mset M = B \<and> size M = card A}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card {M. set_mset M = B \<and> size M = card A}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card {M. set_mset M = B \<and> size M = card A}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
have "card ?MSet = (card A - 1) choose (card A - card B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {M. set_mset M = B \<and> size M = card A} = card A - 1 choose (card A - card B)
[PROOF STEP]
using \<open>finite B\<close> \<open>card B \<le> card A\<close>
[PROOF STATE]
proof (prove)
using this:
finite B
card B \<le> card A

goal (1 subgoal):
 1. card {M. set_mset M = B \<and> size M = card A} = card A - 1 choose (card A - card B)
[PROOF STEP]
by (rule card_multisets_covering_set)
[PROOF STATE]
proof (state)
this:
card {M. set_mset M = B \<and> size M = card A} = card A - 1 choose (card A - card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card ({f \<in> A \<rightarrow>\<^sub>E B. f ` A = B} // domain_permutation A B) = card A - 1 choose (card A - card B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_inverse:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra"
  assumes "continuous F f"
    and "f (Lim F (\<lambda>x. x)) \<noteq> 0"
  shows "continuous F (\<lambda>x. inverse (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. inverse (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
f (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous F (\<lambda>x. inverse (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F
f (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) \<longlongrightarrow> inverse (f (Lim F (\<lambda>x. x)))) F
[PROOF STEP]
by (rule tendsto_inverse)


[STATEMENT]
theorem set_vebt_succ: "invar_vebt t n \<Longrightarrow> vebt_succ t x = Some sx \<longleftrightarrow> is_succ_in_set (set_vebt t) x sx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_succ t x = Some sx) = is_succ_in_set (set_vebt t) x sx
[PROOF STEP]
by (simp add: succ_corr set_vebt_set_vebt'_valid)


[STATEMENT]
lemma homeomorphic_rel_frontiers_convex_bounded_sets:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "convex S" "bounded S" "convex T" "bounded T"
      and affeq: "aff_dim S = aff_dim T"
    shows  "rel_frontier S homeomorphic rel_frontier T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_frontier S homeomorphic rel_frontier T
[PROOF STEP]
using assms homeomorphic_convex_lemma [of "closure S" "closure T"]
[PROOF STATE]
proof (prove)
using this:
convex S
bounded S
convex T
bounded T
aff_dim S = aff_dim T
\<lbrakk>convex (closure S); compact (closure S); convex (closure T); compact (closure T); aff_dim (closure S) = aff_dim (closure T)\<rbrakk> \<Longrightarrow> closure S - rel_interior (closure S) homeomorphic closure T - rel_interior (closure T) \<and> closure S homeomorphic closure T

goal (1 subgoal):
 1. rel_frontier S homeomorphic rel_frontier T
[PROOF STEP]
by (simp add: rel_frontier_def convex_rel_interior_closure)


[STATEMENT]
lemma Schwartz_inequality:
  assumes "f square_integrable S" "g square_integrable S"
  shows "l2product S f g \<le> l2norm S f * l2norm S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product S f g \<le> l2norm S f * l2norm S g
[PROOF STEP]
using Schwartz_inequality_abs assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f square_integrable ?S; ?g square_integrable ?S\<rbrakk> \<Longrightarrow> \<bar>l2product ?S ?f ?g\<bar> \<le> l2norm ?S ?f * l2norm ?S ?g
f square_integrable S
g square_integrable S

goal (1 subgoal):
 1. l2product S f g \<le> l2norm S f * l2norm S g
[PROOF STEP]
by fastforce


[STATEMENT]
lemma integral_component_ubound:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "f integrable_on cbox a b"
    and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B"
    and "k \<in> Basis"
  shows "(integral (cbox a b) f)\<bullet>k \<le> B * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox a b) f \<bullet> k \<le> B * content (cbox a b)
[PROOF STEP]
using assms has_integral_component_ubound
[PROOF STATE]
proof (prove)
using this:
f integrable_on cbox a b
\<forall>x\<in>cbox a b. f x \<bullet> k \<le> B
k \<in> Basis
\<lbrakk>(?f has_integral ?i) (cbox ?a ?b); \<forall>x\<in>cbox ?a ?b. ?f x \<bullet> ?k \<le> ?B; ?k \<in> Basis\<rbrakk> \<Longrightarrow> ?i \<bullet> ?k \<le> ?B * content (cbox ?a ?b)

goal (1 subgoal):
 1. integral (cbox a b) f \<bullet> k \<le> B * content (cbox a b)
[PROOF STEP]
by blast


[STATEMENT]
lemma nat_less_mult_monoish: "\<lbrakk> a < b; c < (d :: nat) \<rbrakk> \<Longrightarrow> (a + 1) * (c + 1) <= b * d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; c < d\<rbrakk> \<Longrightarrow> (a + 1) * (c + 1) \<le> b * d
[PROOF STEP]
apply (drule Suc_leI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc a \<le> b; Suc c \<le> d\<rbrakk> \<Longrightarrow> (a + 1) * (c + 1) \<le> b * d
[PROOF STEP]
apply (drule(1) mult_le_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc c \<le> d; Suc a * Suc c \<le> b * d\<rbrakk> \<Longrightarrow> (a + 1) * (c + 1) \<le> b * d
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma one_less_floor [simp]: "1 < \<lfloor>x\<rfloor> \<longleftrightarrow> 2 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < \<lfloor>x\<rfloor>) = ((2::'a) \<le> x)
[PROOF STEP]
by (simp add: less_floor_iff)


[STATEMENT]
theorem summatory_divisor_count_asymptotics'':
  "sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x -
           (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> O(sqrt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x - (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> O(sqrt)
[PROOF STEP]
by (rule summatory_divisor_count_asymptotics)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x - (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> O(sqrt)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x - (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> O(sqrt)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
have "sqrt \<in> \<Theta>(\<lambda>x. x powr (1/2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt \<in> \<Theta>(\<lambda>x. x powr (1 / 2))
[PROOF STEP]
by (intro bigthetaI_cong eventually_mono [OF eventually_ge_at_top[of "0::real"]])
       (auto elim!: eventually_mono simp: powr_half_sqrt)
[PROOF STATE]
proof (state)
this:
sqrt \<in> \<Theta>(\<lambda>x. x powr (1 / 2))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt \<in> \<Theta>(\<lambda>x. x powr (1 / 2))

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
have "(\<lambda>x::real. x powr (1/2)) \<in> o(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x powr (1 / 2)) \<in> o(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x powr (1 / 2)) \<in> o(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x - (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> o(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)
[PROOF STEP]
have "sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top]
                  (\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. sum_upto (\<lambda>n. real (divisor_count n)) x - (x * ln x + (2 * euler_mascheroni - 1) * x)) \<in> o(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)
[PROOF STEP]
by (simp add: asymp_equiv_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
have "\<dots> \<sim>[at_top] (\<lambda>x. x * ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
by (subst asymp_equiv_add_right) simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * ln x + (2 * euler_mascheroni - 1) * x) \<sim>[at_top] (\<lambda>x. x * ln x)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>c d. c \<sim>[at_top] d \<Longrightarrow> c \<sim>[at_top] d) \<Longrightarrow> sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>a. a * ln a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>c d. c \<sim>[at_top] d \<Longrightarrow> c \<sim>[at_top] d) \<Longrightarrow> sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>a. a * ln a)

goal (1 subgoal):
 1. sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. real (divisor_count n)) \<sim>[at_top] (\<lambda>x. x * ln x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma similarity_inv:
  assumes "similarity A M1 = M2" and "mat_det A \<noteq> 0"
  shows "similarity (mat_inv A) M2 = M1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similarity (mat_inv A) M2 = M1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
similarity A M1 = M2
mat_det A \<noteq> 0

goal (1 subgoal):
 1. similarity (mat_inv A) M2 = M1
[PROOF STEP]
unfolding similarity_def
[PROOF STATE]
proof (prove)
using this:
mat_inv A *\<^sub>m\<^sub>m M1 *\<^sub>m\<^sub>m A = M2
mat_det A \<noteq> 0

goal (1 subgoal):
 1. mat_inv (mat_inv A) *\<^sub>m\<^sub>m M2 *\<^sub>m\<^sub>m mat_inv A = M1
[PROOF STEP]
by (metis mat_det_mult mult_mm_assoc mult_mm_inv_l mult_mm_inv_r mult_zero_left)


[STATEMENT]
lemma nn_integral_geometric_pmf:
  assumes "p \<in> {0<..1}"
  shows   "nn_integral (geometric_pmf p) real = (1 - p) / p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (geometric_pmf p) = ennreal ((1 - p) / p)
[PROOF STEP]
using assms expectation_geometric_pmf integrable_real_geometric_pmf
[PROOF STATE]
proof (prove)
using this:
p \<in> {0<..1}
?p \<in> {0<..1} \<Longrightarrow> measure_pmf.expectation (geometric_pmf ?p) real = (1 - ?p) / ?p
?p \<in> {0<..1} \<Longrightarrow> integrable (measure_pmf (geometric_pmf ?p)) real

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (geometric_pmf p) = ennreal ((1 - p) / p)
[PROOF STEP]
by (subst nn_integral_eq_integral) auto


[STATEMENT]
lemma approx_minus_iff: "x \<approx> y \<longleftrightarrow> x - y \<approx> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<approx> y) = (x - y \<approx> 0)
[PROOF STEP]
by (simp add: approx_def)


[STATEMENT]
lemma frechet_derivative_compose:
  "frechet_derivative (f o g) (at x) = frechet_derivative (f) (at (g x)) o frechet_derivative g (at x)"
  if "g differentiable at x" "f differentiable at (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frechet_derivative (f \<circ> g) (at x) = frechet_derivative f (at (g x)) \<circ> frechet_derivative g (at x)
[PROOF STEP]
by (metis diff_chain_at frechet_derivative_at frechet_derivative_works that)


[STATEMENT]
lemma simply_connected_eq_contractible_loop_all:
  fixes S :: "_::real_normed_vector set"
  shows "simply_connected S \<longleftrightarrow>
         S = {} \<or>
         (\<exists>a \<in> S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p
                \<longrightarrow> homotopic_loops S p (linepath a a))"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
 2. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
 2. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain a where "a \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a. a \<in> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> S

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. simply_connected S \<Longrightarrow> S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))
 2. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)) \<Longrightarrow> simply_connected S
[PROOF STEP]
assume "simply_connected S"
[PROOF STATE]
proof (state)
this:
simply_connected S

goal (2 subgoals):
 1. simply_connected S \<Longrightarrow> S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))
 2. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)) \<Longrightarrow> simply_connected S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
simply_connected S
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
simply_connected S

goal (1 subgoal):
 1. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))
[PROOF STEP]
using \<open>a \<in> S\<close> \<open>simply_connected S\<close> simply_connected_eq_contractible_loop_any
[PROOF STATE]
proof (prove)
using this:
simply_connected S
a \<in> S
simply_connected S
simply_connected ?S = (\<forall>p a. path p \<and> path_image p \<subseteq> ?S \<and> pathfinish p = pathstart p \<and> a \<in> ?S \<longrightarrow> homotopic_loops ?S p (linepath a a))

goal (1 subgoal):
 1. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))

goal (1 subgoal):
 1. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)) \<Longrightarrow> simply_connected S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)) \<Longrightarrow> simply_connected S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))

goal (1 subgoal):
 1. S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)) \<Longrightarrow> simply_connected S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))
[PROOF STEP]
show "simply_connected S"
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))

goal (1 subgoal):
 1. simply_connected S
[PROOF STEP]
unfolding simply_connected_eq_contractible_loop_any
[PROOF STATE]
proof (prove)
using this:
S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a))

goal (1 subgoal):
 1. \<forall>p a. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<and> a \<in> S \<longrightarrow> homotopic_loops S p (linepath a a)
[PROOF STEP]
by (meson False homotopic_loops_refl homotopic_loops_sym homotopic_loops_trans
          path_component_imp_homotopic_points path_component_refl)
[PROOF STATE]
proof (state)
this:
simply_connected S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
simply_connected S = (S = {} \<or> (\<exists>a\<in>S. \<forall>p. path p \<and> path_image p \<subseteq> S \<and> pathfinish p = pathstart p \<longrightarrow> homotopic_loops S p (linepath a a)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "!!x. (x::nat) <= y ==> x - y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<le> y \<Longrightarrow> x - y = 0
[PROOF STEP]
by linarith


[STATEMENT]
theorem p1: "(p \<longrightarrow> q) \<longleftrightarrow> (\<not>q \<longrightarrow> \<not>p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<longrightarrow> q) = (\<not> q \<longrightarrow> \<not> p)
[PROOF STEP]
by auto2


[STATEMENT]
lemma "((x::int) - y) ^ 3 = x ^ 3 + 3 * x * y ^ 2 + (- 3) * y * x ^ 2 - y ^ 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) ^ 3 = x ^ 3 + 3 * x * y\<^sup>2 + - 3 * y * x\<^sup>2 - y ^ 3
[PROOF STEP]
by ring


[STATEMENT]
lemma totient_gt_1:
  assumes "n > 2"
  shows   "totient n > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
have "{1, n - 1} \<subseteq> totatives n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1, n - 1} \<subseteq> totatives n
[PROOF STEP]
using assms coprime_diff_one_left_nat[of n]
[PROOF STATE]
proof (prove)
using this:
2 < n
0 < n \<Longrightarrow> coprime (n - 1) n

goal (1 subgoal):
 1. {1, n - 1} \<subseteq> totatives n
[PROOF STEP]
by (auto simp: totatives_def)
[PROOF STATE]
proof (state)
this:
{1, n - 1} \<subseteq> totatives n

goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
hence "card {1, n - 1} \<le> card (totatives n)"
[PROOF STATE]
proof (prove)
using this:
{1, n - 1} \<subseteq> totatives n

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

goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card {1, n - 1} \<le> card (totatives n)

goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card {1, n - 1} \<le> card (totatives n)
2 < n

goal (1 subgoal):
 1. 1 < totient n
[PROOF STEP]
by (simp add: totient_def)
[PROOF STATE]
proof (state)
this:
1 < totient n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_to_01open_inverse_correct':
  assumes "0 < r" "r < 1"
  shows "real_to_01open (real_to_01open_inverse r) = r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_to_01open (real_to_01open_inverse r) = r
[PROOF STEP]
unfolding real_to_01open_def real_to_01open_inverse_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
have "arctan (tan (pi * r - pi / 2)) = pi * r - pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) = pi * r - pi / 2
[PROOF STEP]
using  arctan_unique[of "pi * r - pi / 2"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (pi / 2) < pi * r - pi / 2; pi * r - pi / 2 < pi / 2; tan (pi * r - pi / 2) = ?y\<rbrakk> \<Longrightarrow> arctan ?y = pi * r - pi / 2
0 < r
r < 1

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) = pi * r - pi / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
arctan (tan (pi * r - pi / 2)) = pi * r - pi / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
hence "arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = ((pi * r) - pi / 2)/ pi + 1/2"
[PROOF STATE]
proof (prove)
using this:
arctan (tan (pi * r - pi / 2)) = pi * r - pi / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = (pi * r - pi / 2) / pi + 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = (pi * r - pi / 2) / pi + 1 / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = (pi * r - pi / 2) / pi + 1 / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
have "... = r - 1/2 + 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pi * r - pi / 2) / pi + 1 / 2 = r - 1 / 2 + 1 / 2
[PROOF STEP]
by (metis (no_types, opaque_lifting) divide_inverse mult.left_neutral nonzero_mult_div_cancel_left pi_neq_zero right_diff_distrib)
[PROOF STATE]
proof (state)
this:
(pi * r - pi / 2) / pi + 1 / 2 = r - 1 / 2 + 1 / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r - 1 / 2 + 1 / 2
[PROOF STEP]
show "arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r"
[PROOF STATE]
proof (prove)
using this:
arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r - 1 / 2 + 1 / 2

goal (1 subgoal):
 1. arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
arctan (tan (pi * r - pi / 2)) / pi + 1 / 2 = r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_image_left_mult:
  "(MAX x \<in> S. c * f x) = (c :: ennreal) * (MAX x \<in> S. f x)" if "S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MAX x\<in>S. c * f x) = c * Max (f ` S)
[PROOF STEP]
apply (rule Max_eqI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite ((\<lambda>x. c * f x) ` S)
 2. \<And>y. y \<in> (\<lambda>x. c * f x) ` S \<Longrightarrow> y \<le> c * Max (f ` S)
 3. c * Max (f ` S) \<in> (\<lambda>x. c * f x) ` S
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. c * f x) ` S)
[PROOF STEP]
using \<open>finite S\<close>
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite ((\<lambda>x. c * f x) ` S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. y \<in> (\<lambda>x. c * f x) ` S \<Longrightarrow> y \<le> c * Max (f ` S)
 2. c * Max (f ` S) \<in> (\<lambda>x. c * f x) ` S
[PROOF STEP]
subgoal for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> (\<lambda>x. c * f x) ` S \<Longrightarrow> y \<le> c * Max (f ` S)
[PROOF STEP]
using \<open>finite S\<close>
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. y \<in> (\<lambda>x. c * f x) ` S \<Longrightarrow> y \<le> c * Max (f ` S)
[PROOF STEP]
by (auto intro: mult_left_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * Max (f ` S) \<in> (\<lambda>x. c * f x) ` S
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * Max (f ` S) \<in> (\<lambda>x. c * f x) ` S
[PROOF STEP]
using Max_in[OF finite_imageI[OF \<open>finite S\<close>], of f] \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
f ` S \<noteq> {} \<Longrightarrow> Max (f ` S) \<in> f ` S
S \<noteq> {}

goal (1 subgoal):
 1. c * Max (f ` S) \<in> (\<lambda>x. c * f x) ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fds_abs_converges_scaleR [intro]:
  assumes "fds_abs_converges f s"
  shows   "fds_abs_converges (c *\<^sub>R f) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
fds_abs_converges f s
[PROOF STEP]
have "summable (\<lambda>n. abs c * norm (fds_nth f n / nat_power n s))"
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges f s

goal (1 subgoal):
 1. summable (\<lambda>n. \<bar>c\<bar> * norm (fds_nth f n / nat_power n s))
[PROOF STEP]
by (intro summable_mult) (auto simp: fds_abs_converges_def)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. \<bar>c\<bar> * norm (fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. \<bar>c\<bar> * norm (fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
have "(\<lambda>n. abs c * norm (fds_nth f n / nat_power n s)) =
               (\<lambda>n. norm ((c *\<^sub>R fds_nth f n) / nat_power n s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>c\<bar> * norm (fds_nth f n / nat_power n s)) = (\<lambda>n. norm (c *\<^sub>R fds_nth f n / nat_power n s))
[PROOF STEP]
by (simp add: norm_divide)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>c\<bar> * norm (fds_nth f n / nat_power n s)) = (\<lambda>n. norm (c *\<^sub>R fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. norm (c *\<^sub>R fds_nth f n / nat_power n s))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. norm (c *\<^sub>R fds_nth f n / nat_power n s))

goal (1 subgoal):
 1. fds_abs_converges (c *\<^sub>R f) s
[PROOF STEP]
by (simp add: fds_abs_converges_def)
[PROOF STATE]
proof (state)
this:
fds_abs_converges (c *\<^sub>R f) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "bool_fun_threshold_2_3 (vec 4 (\<lambda>i. if i = 0 then False else True))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bool_fun_threshold_2_3 (vec 4 (\<lambda>i. if i = 0 then False else True))
[PROOF STEP]
unfolding bool_fun_threshold_2_3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if 2 \<le> count_true (vec 4 (\<lambda>i. if i = 0 then False else True)) then True else False
[PROOF STEP]
unfolding count_true_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if 2 \<le> (\<Sum>i = 0..<dim_vec (vec 4 (\<lambda>i. if i = 0 then False else True)). if vec 4 (\<lambda>i. if i = 0 then False else True) $ i then 1 else 0) then True else False
[PROOF STEP]
unfolding dim_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if 2 \<le> (\<Sum>i = 0..<4. if vec 4 (\<lambda>i. if i = 0 then False else True) $ i then 1 else 0) then True else False
[PROOF STEP]
unfolding sum.eq_fold
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. if 2 \<le> Finite_Set.fold ((+) \<circ> (\<lambda>i. if vec 4 (\<lambda>i. if i = 0 then False else True) $ i then 1 else 0)) 0 {0..<4} then True else False
[PROOF STEP]
using index_vec [of _ 4]
[PROOF STATE]
proof (prove)
using this:
?i < 4 \<Longrightarrow> vec 4 ?f $ ?i = ?f ?i

goal (1 subgoal):
 1. if 2 \<le> Finite_Set.fold ((+) \<circ> (\<lambda>i. if vec 4 (\<lambda>i. if i = 0 then False else True) $ i then 1 else 0)) 0 {0..<4} then True else False
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> Finite_Set.fold ((+) \<circ> (\<lambda>i. if vec 4 ((<) 0) $ i then 1 else 0)) 0 {0..<4}
[PROOF STEP]
unfolding set_list_four
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> Finite_Set.fold ((+) \<circ> (\<lambda>i. if vec 4 ((<) 0) $ i then 1 else 0)) 0 (set [0, 1, 2, 3])
[PROOF STEP]
unfolding comp_fun_commute_on.fold_set_fold_remdups [OF comp_fun_commute_lambda, simplified]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> fold ((+) \<circ> (\<lambda>i. if vec 4 ((<) 0) $ i then 1 else 0)) (remdups [0, 1, 2, 3]) 0
[PROOF STEP]
by simp


[STATEMENT]
lemma exists_connected_component_of_superset:
  assumes "connectedin X S" and ne: "topspace X \<noteq> {}"
  shows "\<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
 2. S \<noteq> {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
 2. S \<noteq> {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
using ne connected_components_of_def
[PROOF STATE]
proof (prove)
using this:
S = {}
topspace X \<noteq> {}
connected_components_of ?X \<equiv> connected_component_of_set ?X ` topspace ?X

goal (1 subgoal):
 1. \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

goal (1 subgoal):
 1. \<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C
[PROOF STEP]
by (meson all_not_in_conv assms(1) connected_component_in_connected_components_of connected_component_of_maximal connectedin_subset_topspace in_mono)
[PROOF STATE]
proof (state)
this:
\<exists>C. C \<in> connected_components_of X \<and> S \<subseteq> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_bst_of_list_distinct [simp]:
  assumes "distinct xs"
  shows   "size (bst_of_list xs) = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (bst_of_list xs) = length xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. size (bst_of_list xs) = length xs
[PROOF STEP]
by (induction xs rule: rev_induct) (auto simp: size_bst_insert)


[STATEMENT]
lemma hom_frag_add:
  assumes "h \<in> hom (free_Abelian_group S) (free_Abelian_group T)" "Poly_Mapping.keys a \<subseteq> S" "Poly_Mapping.keys b \<subseteq> S"
  shows "h (a+b) = h a + h b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
have "Poly_Mapping.keys (h a) \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.keys (h a) \<subseteq> T
[PROOF STEP]
by (meson assms carrier_free_Abelian_group_iff hom_in_carrier)
[PROOF STATE]
proof (state)
this:
Poly_Mapping.keys (h a) \<subseteq> T

goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Poly_Mapping.keys (h a) \<subseteq> T

goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
have "Poly_Mapping.keys (h b) \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Poly_Mapping.keys (h b) \<subseteq> T
[PROOF STEP]
by (meson assms carrier_free_Abelian_group_iff hom_in_carrier)
[PROOF STATE]
proof (state)
this:
Poly_Mapping.keys (h b) \<subseteq> T

goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Poly_Mapping.keys (h a) \<subseteq> T
Poly_Mapping.keys (h b) \<subseteq> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Poly_Mapping.keys (h a) \<subseteq> T
Poly_Mapping.keys (h b) \<subseteq> T

goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
using assms hom_mult
[PROOF STATE]
proof (prove)
using this:
Poly_Mapping.keys (h a) \<subseteq> T
Poly_Mapping.keys (h b) \<subseteq> T
h \<in> hom (free_Abelian_group S) (free_Abelian_group T)
Poly_Mapping.keys a \<subseteq> S
Poly_Mapping.keys b \<subseteq> S
\<lbrakk>?h \<in> hom ?G ?H; ?x \<in> carrier ?G; ?y \<in> carrier ?G\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?G\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?H\<^esub> ?h ?y

goal (1 subgoal):
 1. h (a + b) = h a + h b
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
h (a + b) = h a + h b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Apollonius':
  fixes A B C :: "'a::euclidean_space"
  assumes "B \<noteq> C"
  shows "(dist A C)\<^sup>2 + (dist B A)\<^sup>2 = 2 * ((dist B (midpoint B C))\<^sup>2 + (dist A (midpoint B C))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist A C)\<^sup>2 + (dist B A)\<^sup>2 = 2 * ((dist B (midpoint B C))\<^sup>2 + (dist A (midpoint B C))\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<noteq> C

goal (1 subgoal):
 1. (dist A C)\<^sup>2 + (dist B A)\<^sup>2 = 2 * ((dist B (midpoint B C))\<^sup>2 + (dist A (midpoint B C))\<^sup>2)
[PROOF STEP]
by (rule Apollonius) auto


[STATEMENT]
theorem time_vebt_member: "invar_vebt t n \<Longrightarrow> u =  2^n \<Longrightarrow>  T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x \<le> 30 + 15 * lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x) \<le> 30 + 15 * log 2 (log 2 u)
[PROOF STEP]
using member_bound_size_univ
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar_vebt ?t ?n; ?u = 2 ^ ?n\<rbrakk> \<Longrightarrow> real (T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r ?t ?x) \<le> 30 + 15 * log 2 (log 2 ?u)

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; u = 2 ^ n\<rbrakk> \<Longrightarrow> real (T\<^sub>m\<^sub>e\<^sub>m\<^sub>b\<^sub>e\<^sub>r t x) \<le> 30 + 15 * log 2 (log 2 u)
[PROOF STEP]
by auto


[STATEMENT]
lemma change_eval_eq:
  fixes x y:: "real"
  assumes "((aEvalUni (EqUni(a,b,c)) x \<noteq> aEvalUni (EqUni(a,b,c)) y) \<and> x < y)"
  shows "(\<exists>w. x \<le> w \<and> w \<le> y \<and> a*w^2 + b*w + c = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w\<ge>x. w \<le> y \<and> a * w\<^sup>2 + b * w + c = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
aEvalUni (EqUni (a, b, c)) x \<noteq> aEvalUni (EqUni (a, b, c)) y \<and> x < y

goal (1 subgoal):
 1. \<exists>w\<ge>x. w \<le> y \<and> a * w\<^sup>2 + b * w + c = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_at_to_0:
  "eventually P (at a) \<longleftrightarrow> eventually (\<lambda>x. P (x + a)) (at 0)"
  for a ::  "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at a) = (\<forall>\<^sub>F x in at (0::'a). P (x + a))
[PROOF STEP]
unfolding at_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (filtermap (\<lambda>x. x + a) (at (0::'a))) = (\<forall>\<^sub>F x in at (0::'a). P (x + a))
[PROOF STEP]
by (simp add: eventually_filtermap)


[STATEMENT]
lemma higher_pderiv_mult:
  "(pderiv ^^ n) (p * q) =
     (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q))
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have eq: "(Suc n choose k) = (n choose k) + (n choose (k-1))" if "k > 0" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n choose k = n choose k + (n choose (k - 1))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. Suc n choose k = n choose k + (n choose (k - 1))
[PROOF STEP]
by (cases k) auto
[PROOF STATE]
proof (state)
this:
0 < ?k \<Longrightarrow> Suc n choose ?k = n choose ?k + (n choose (?k - 1))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "(pderiv ^^ Suc n) (p * q) =
          (\<Sum>k\<le>n. smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) +
          (\<Sum>k\<le>n. smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q))
[PROOF STEP]
by (simp add: Suc pderiv_sum pderiv_smult pderiv_mult sum.distrib smult_add_right algebra_simps Suc_diff_le)
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "(\<Sum>k\<le>n. smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) =
             (\<Sum>k\<in>insert 0 {1..n}. smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
by (intro sum.cong) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "\<dots> = (\<Sum>k=1..n. smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q
[PROOF STEP]
by (subst sum.insert) (auto simp: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert 0 {1..n}. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "(\<Sum>k\<le>n. smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q)) =
             (\<Sum>k=1..n+1. smult (of_nat (n choose (k-1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q)) = (\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ "\<lambda>k. k - 1" Suc]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q)) = (\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ Suc k) p * (pderiv ^^ (n - k)) q)) = (\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>insert (n+1) {1..n}. smult (of_nat (n choose (k-1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
by (intro sum.cong) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n + 1. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "\<dots> = (\<Sum>k=1..n. smult (of_nat (n choose (k-1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q
[PROOF STEP]
by (subst sum.insert) (auto simp: add_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>insert (n + 1) {1..n}. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "(\<Sum>k=1..n. smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) +
                 p * (pderiv ^^ Suc n) q + \<dots> =
             (\<Sum>k=1..n. smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) +
                 p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + ((\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q
[PROOF STEP]
by (simp add: sum.distrib algebra_simps smult_add_right eq smult_add_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + ((\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + ((\<Sum>k = 1..n. Polynomial.smult (of_nat (n choose (k - 1))) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + (pderiv ^^ Suc n) p * q) = (\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "\<dots> = (\<Sum>k\<in>{1..n}\<union>{0,Suc n}. smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q = (\<Sum>k\<in>{1..n} \<union> {0, Suc n}. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
by (subst sum.union_disjoint) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q = (\<Sum>k\<in>{1..n} \<union> {0, Suc n}. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 1..n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q)) + p * (pderiv ^^ Suc n) q + (pderiv ^^ Suc n) p * q = (\<Sum>k\<in>{1..n} \<union> {0, Suc n}. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
have "{1..n}\<union>{0,Suc n} = {..Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..n} \<union> {0, Suc n} = {..Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..n} \<union> {0, Suc n} = {..Suc n}

goal (2 subgoals):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
 2. \<And>n. (pderiv ^^ n) (p * q) = (\<Sum>k\<le>n. Polynomial.smult (of_nat (n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (n - k)) q)) \<Longrightarrow> (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (1 subgoal):
 1. (pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(pderiv ^^ Suc n) (p * q) = (\<Sum>k\<le>Suc n. Polynomial.smult (of_nat (Suc n choose k)) ((pderiv ^^ k) p * (pderiv ^^ (Suc n - k)) q))

goal (1 subgoal):
 1. (pderiv ^^ 0) (p * q) = (\<Sum>k\<le>0. Polynomial.smult (of_nat (0 choose k)) ((pderiv ^^ k) p * (pderiv ^^ (0 - k)) q))
[PROOF STEP]
qed auto


[STATEMENT]
lemma lead_coeff_mult_aux:
  "coeff (p * q) (lead_monom p + lead_monom q) = lead_coeff p * lead_coeff q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
proof (cases "p = 0 \<or> q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (p = 0 \<or> q = 0)

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
define a b where "a = lead_monom p" and "b = lead_monom q"
[PROOF STATE]
proof (state)
this:
a = lead_monom p
b = lead_monom q

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
have "coeff (p * q) (a + b) = coeff p a * coeff q b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (p * q) (a + b) = MPoly_Type.coeff p a * MPoly_Type.coeff q b
[PROOF STEP]
unfolding coeff_mpoly_times
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_fun (MPoly_Type.coeff p) (MPoly_Type.coeff q) (a + b) = MPoly_Type.coeff p a * MPoly_Type.coeff q b
[PROOF STEP]
by (rule prod_fun_max) (insert False, auto simp: a_def b_def)
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (p * q) (a + b) = MPoly_Type.coeff p a * MPoly_Type.coeff q b

goal (2 subgoals):
 1. p = 0 \<or> q = 0 \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
 2. \<not> (p = 0 \<or> q = 0) \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
MPoly_Type.coeff (p * q) (a + b) = MPoly_Type.coeff p a * MPoly_Type.coeff q b

goal (1 subgoal):
 1. MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
by (simp add: a_def b_def lead_coeff_def)
[PROOF STATE]
proof (state)
this:
MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q

goal (1 subgoal):
 1. p = 0 \<or> q = 0 \<Longrightarrow> MPoly_Type.coeff (p * q) (lead_monom p + lead_monom q) = Symmetric_Polynomials.lead_coeff p * Symmetric_Polynomials.lead_coeff q
[PROOF STEP]
qed auto


[STATEMENT]
lemma pi_less_4: "pi < 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi < 4
[PROOF STEP]
using pi_half_less_two
[PROOF STATE]
proof (prove)
using this:
pi / 2 < 2

goal (1 subgoal):
 1. pi < 4
[PROOF STEP]
by auto


[STATEMENT]
lemma value_plus_flow:
  assumes wf: "wf_residual_network"
  and f: "flow \<Delta> f"
  and g: "flow (residual_network f) g"
  shows "value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
interpret RES: countable_network "residual_network f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable_network (residual_network f)
[PROOF STEP]
using wf f
[PROOF STATE]
proof (prove)
using this:
wf_residual_network
flow \<Delta> f

goal (1 subgoal):
 1. countable_network (residual_network f)
[PROOF STEP]
by(rule residual_countable_network)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
have "value_flow \<Delta> (f \<oplus> g) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y))
[PROOF STEP]
unfolding d_OUT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y. (f \<oplus> g) (source \<Delta>, y)) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y))
[PROOF STEP]
by(rule nn_integral_cong)(simp add: flowD_outside[OF f] RES.flowD_outside[OF g] source_in)
[PROOF STATE]
proof (state)
this:
value_flow \<Delta> (f \<oplus> g) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y))

goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
value_flow \<Delta> (f \<oplus> g) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y))

goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
have "\<dots> = value_flow \<Delta> f + value_flow \<Delta> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y)) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
unfolding d_OUT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y)) = (\<Sum>\<^sup>+ y. f (source \<Delta>, y)) + (\<Sum>\<^sup>+ y. g (source \<Delta>, y))
[PROOF STEP]
by(rule nn_integral_add) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sup>+ y. f (source \<Delta>, y) + g (source \<Delta>, y)) = value_flow \<Delta> f + value_flow \<Delta> g

goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g

goal (1 subgoal):
 1. value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
value_flow \<Delta> (f \<oplus> g) = value_flow \<Delta> f + value_flow \<Delta> g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma absolutely_integrable_mult_Fejer_kernel_reflected1:
  assumes f: "f absolutely_integrable_on {-pi..pi}"
    and periodic: "\<And>x. f(x + 2*pi) = f x"
  shows "(\<lambda>x. Fejer_kernel n x * f(t + x)) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Fejer_kernel n x * f (t + x)) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f absolutely_integrable_on {- pi..pi}
f (?x + 2 * pi) = f ?x

goal (1 subgoal):
 1. (\<lambda>x. Fejer_kernel n x * f (t + x)) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
by (force intro: absolutely_integrable_mult_Fejer_kernel absolutely_integrable_periodic_offset)


[STATEMENT]
lemma open_vimageI: "(\<And>x. f \<midarrow>x\<rightarrow> f x) \<Longrightarrow> open A \<Longrightarrow> open (f -` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. f \<midarrow>x\<rightarrow> f x; open A\<rbrakk> \<Longrightarrow> open (f -` A)
[PROOF STEP]
using continuous_on_open_vimage[of UNIV f] continuous_on_def[of UNIV f]
[PROOF STATE]
proof (prove)
using this:
open UNIV \<Longrightarrow> continuous_on UNIV f = (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> UNIV))
continuous_on UNIV f = (\<forall>x\<in>UNIV. f \<midarrow>x\<rightarrow> f x)

goal (1 subgoal):
 1. \<lbrakk>\<And>x. f \<midarrow>x\<rightarrow> f x; open A\<rbrakk> \<Longrightarrow> open (f -` A)
[PROOF STEP]
by simp


[STATEMENT]
lemma iT_Div_Max: "\<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow> Max (I \<oslash> k) = Max I div k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> Max (I \<oslash> k) = Max I div k
[PROOF STEP]
by (simp add: iT_Div_def Max_mono2 mono_def div_le_mono)


[STATEMENT]
lemma integrable_reflect[simp]: "(\<lambda>x. f(-x)) integrable_on cbox (-b) (-a) \<longleftrightarrow> f integrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (- x)) integrable_on cbox (- b) (- a)) = (f integrable_on cbox a b)
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y. ((\<lambda>x. f (- x)) has_integral y) (cbox (- b) (- a))) = (\<exists>y. (f has_integral y) (cbox a b))
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_fps_minus:
  fixes f :: "'a :: {banach, real_normed_div_algebra} fps"
  assumes "norm z < fps_conv_radius f"
  shows   "eval_fps (-f) z = -eval_fps f z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (- f) z = - eval_fps f z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f

goal (1 subgoal):
 1. eval_fps (- f) z = - eval_fps f z
[PROOF STEP]
unfolding eval_fps_def
[PROOF STATE]
proof (prove)
using this:
ereal (norm z) < fps_conv_radius f

goal (1 subgoal):
 1. (\<Sum>n. fps_nth (- f) n * z ^ n) = - (\<Sum>n. fps_nth f n * z ^ n)
[PROOF STEP]
by (subst suminf_minus [symmetric]) (auto intro!: summable_fps)


[STATEMENT]
lemma add_sum_int:
  fixes j k l :: int
  shows "j < k \<Longrightarrow> k < l \<Longrightarrow>
    sum f {j..<k} + sum f {k..<l} = sum f {j..<l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < k; k < l\<rbrakk> \<Longrightarrow> sum f {j..<k} + sum f {k..<l} = sum f {j..<l}
[PROOF STEP]
by (simp_all add: sum.union_inter [symmetric] ivl_disj_un)