[STATEMENT]
lemma leq_ccsubspace_code[code]:
  \<comment> \<open>Code equation for deciding inclusion of one space in another.
     Uses the constant \<^term>\<open>is_subspace_of_vec_list\<close> which implements the actual
     computation by checking for each generator of A whether it is in the
     span of B (by orthogonal projection onto an orthonormal basis of B
     which is computed using Gram-Schmidt).\<close>
  "SPAN A \<le> (SPAN B :: 'a::onb_enum ccsubspace)
      \<longleftrightarrow> (let d = length (canonical_basis :: 'a list) in
          is_subspace_of_vec_list d
          (filter (\<lambda>v. dim_vec v = d) A)
          (filter (\<lambda>v. dim_vec v = d) B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SPAN A \<le> SPAN B) = (let d = length canonical_basis in is_subspace_of_vec_list d (filter (\<lambda>v. dim_vec v = d) A) (filter (\<lambda>v. dim_vec v = d) B))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (SPAN A \<le> SPAN B) = (let d = length canonical_basis in is_subspace_of_vec_list d (filter (\<lambda>v. dim_vec v = d) A) (filter (\<lambda>v. dim_vec v = d) B))
[PROOF STEP]
define d A' B' where "d = length (canonical_basis :: 'a list)"
    and "A' = filter (\<lambda>v. dim_vec v = d) A"
    and "B' = filter (\<lambda>v. dim_vec v = d) B"
[PROOF STATE]
proof (state)
this:
d = length canonical_basis
A' = filter (\<lambda>v. dim_vec v = d) A
B' = filter (\<lambda>v. dim_vec v = d) B

goal (1 subgoal):
 1. (SPAN A \<le> SPAN B) = (let d = length canonical_basis in is_subspace_of_vec_list d (filter (\<lambda>v. dim_vec v = d) A) (filter (\<lambda>v. dim_vec v = d) B))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SPAN A \<le> SPAN B) = (let d = length canonical_basis in is_subspace_of_vec_list d (filter (\<lambda>v. dim_vec v = d) A) (filter (\<lambda>v. dim_vec v = d) B))
[PROOF STEP]
unfolding SPAN_def d_def[symmetric] filter_set Let_def
      A'_def[symmetric] B'_def[symmetric] image_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ccspan (set (map basis_enum_of_vec A')) \<le> ccspan (set (map basis_enum_of_vec B'))) = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (subst ccspan_leq_using_vec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_subspace_of_vec_list (length canonical_basis) (map vec_of_basis_enum (map basis_enum_of_vec A')) (map vec_of_basis_enum (map basis_enum_of_vec B')) = is_subspace_of_vec_list d A' B'
[PROOF STEP]
unfolding d_def[symmetric] map_map o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_subspace_of_vec_list d (map (\<lambda>x. vec_of_basis_enum (basis_enum_of_vec x)) A') (map (\<lambda>x. vec_of_basis_enum (basis_enum_of_vec x)) B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (subst map_cong[where xs=A', OF refl])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> set A' \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec x) = ?g x
 2. is_subspace_of_vec_list d (map ?g A') (map (\<lambda>x. vec_of_basis_enum (basis_enum_of_vec x)) B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (rule basis_enum_of_vec_inverse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> set A' \<Longrightarrow> dim_vec x = length canonical_basis
 2. is_subspace_of_vec_list d (map (\<lambda>x. x) A') (map (\<lambda>x. vec_of_basis_enum (basis_enum_of_vec x)) B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (simp add: A'_def d_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_subspace_of_vec_list d (map (\<lambda>x. x) A') (map (\<lambda>x. vec_of_basis_enum (basis_enum_of_vec x)) B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (subst map_cong[where xs=B', OF refl])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> set B' \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec x) = ?g3 x
 2. is_subspace_of_vec_list d (map (\<lambda>x. x) A') (map ?g3 B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
apply (rule basis_enum_of_vec_inverse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> set B' \<Longrightarrow> dim_vec x = length canonical_basis
 2. is_subspace_of_vec_list d (map (\<lambda>x. x) A') (map (\<lambda>x. x) B') = is_subspace_of_vec_list d A' B'
[PROOF STEP]
by (simp_all add: B'_def d_def)
[PROOF STATE]
proof (state)
this:
(SPAN A \<le> SPAN B) = (let d = length canonical_basis in is_subspace_of_vec_list d (filter (\<lambda>v. dim_vec v = d) A) (filter (\<lambda>v. dim_vec v = d) B))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_image: "\<lbrakk> f \<in> A \<rightarrow> B; A1 \<subseteq> A; A2 \<subseteq> A \<rbrakk> \<Longrightarrow>
            f`(A1 \<inter> A2) \<subseteq> (f` A1) \<inter> (f` A2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A; A2 \<subseteq> A\<rbrakk> \<Longrightarrow> f ` (A1 \<inter> A2) \<subseteq> f ` A1 \<inter> f ` A2
[PROOF STEP]
apply (simp add: image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A; A2 \<subseteq> A\<rbrakk> \<Longrightarrow> {y. \<exists>x\<in>A1 \<inter> A2. y = f x} \<subseteq> {y. \<exists>x\<in>A1. y = f x} \<and> {y. \<exists>x\<in>A1 \<inter> A2. y = f x} \<subseteq> {y. \<exists>x\<in>A2. y = f x}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_levelset_openin_cases:
  fixes f :: "_ \<Rightarrow> 'b::t1_space"
  shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow>
        openin (top_of_set s) {x \<in> s. f x = a}
        \<Longrightarrow> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>connected s; continuous_on s f; openin (top_of_set s) {x \<in> s. f x = a}\<rbrakk> \<Longrightarrow> (\<forall>x\<in>s. f x \<noteq> a) \<or> (\<forall>x\<in>s. f x = a)
[PROOF STEP]
unfolding connected_clopen
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>T. openin (top_of_set s) T \<and> closedin (top_of_set s) T \<longrightarrow> T = {} \<or> T = s; continuous_on s f; openin (top_of_set s) {x \<in> s. f x = a}\<rbrakk> \<Longrightarrow> (\<forall>x\<in>s. f x \<noteq> a) \<or> (\<forall>x\<in>s. f x = a)
[PROOF STEP]
using continuous_closedin_preimage_constant
[PROOF STATE]
proof (prove)
using this:
continuous_on ?S ?f \<Longrightarrow> closedin (top_of_set ?S) {x \<in> ?S. ?f x = ?a}

goal (1 subgoal):
 1. \<lbrakk>\<forall>T. openin (top_of_set s) T \<and> closedin (top_of_set s) T \<longrightarrow> T = {} \<or> T = s; continuous_on s f; openin (top_of_set s) {x \<in> s. f x = a}\<rbrakk> \<Longrightarrow> (\<forall>x\<in>s. f x \<noteq> a) \<or> (\<forall>x\<in>s. f x = a)
[PROOF STEP]
by auto


[STATEMENT]
lemma higher_pderiv_0 [simp]: "(pderiv ^^ n) 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv ^^ n) 0 = 0
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma poly_eval_minus: "poly_eval a (p - q) = poly_eval a p - poly_eval (a::_::comm_ring_1) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a (p - q) = poly_eval a p - poly_eval a q
[PROOF STEP]
by (simp only: poly_eval_def poly_subst_minus lookup_minus)


[STATEMENT]
lemma winding_number_ivt_abs:
    assumes \<gamma>: "valid_path \<gamma>" and z: "z \<notin> path_image \<gamma>" and "0 \<le> w" "w \<le> \<bar>Re(winding_number \<gamma> z)\<bar>"
      shows "\<exists>t \<in> {0..1}. \<bar>Re (winding_number (subpath 0 t \<gamma>) z)\<bar> = w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. \<bar>Re (winding_number (subpath 0 t \<gamma>) z)\<bar> = w
[PROOF STEP]
using assms winding_number_ivt_pos [of \<gamma> z w] winding_number_ivt_neg [of \<gamma> z "-w"]
[PROOF STATE]
proof (prove)
using this:
valid_path \<gamma>
z \<notin> path_image \<gamma>
0 \<le> w
w \<le> \<bar>Re (winding_number \<gamma> z)\<bar>
\<lbrakk>valid_path \<gamma>; z \<notin> path_image \<gamma>; 0 \<le> w; w \<le> Re (winding_number \<gamma> z)\<rbrakk> \<Longrightarrow> \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = w
\<lbrakk>valid_path \<gamma>; z \<notin> path_image \<gamma>; Re (winding_number \<gamma> z) \<le> - w; - w \<le> 0\<rbrakk> \<Longrightarrow> \<exists>t\<in>{0..1}. Re (winding_number (subpath 0 t \<gamma>) z) = - w

goal (1 subgoal):
 1. \<exists>t\<in>{0..1}. \<bar>Re (winding_number (subpath 0 t \<gamma>) z)\<bar> = w
[PROOF STEP]
by force


[STATEMENT]
theorem condensation_test:
  assumes mono: "\<And>m. 0 < m \<Longrightarrow> f (Suc m) \<le> f m"
  assumes nonneg: "\<And>n. f n \<ge> 0"
  shows "summable f \<longleftrightarrow> summable (\<lambda>n. 2^n * f (2^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
define f' where "f' n = (if n = 0 then 0 else f n)" for n
[PROOF STATE]
proof (state)
this:
f' ?n = (if ?n = 0 then 0 else f ?n)

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
from mono
[PROOF STATE]
proof (chain)
picking this:
0 < ?m \<Longrightarrow> f (Suc ?m) \<le> f ?m
[PROOF STEP]
have mono': "decseq (\<lambda>n. f (Suc n))"
[PROOF STATE]
proof (prove)
using this:
0 < ?m \<Longrightarrow> f (Suc ?m) \<le> f ?m

goal (1 subgoal):
 1. decseq (\<lambda>n. f (Suc n))
[PROOF STEP]
by (intro decseq_SucI) simp
[PROOF STATE]
proof (state)
this:
decseq (\<lambda>n. f (Suc n))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
hence mono': "f n \<le> f m" if "m \<le> n" "m > 0" for m n
[PROOF STATE]
proof (prove)
using this:
decseq (\<lambda>n. f (Suc n))

goal (1 subgoal):
 1. f n \<le> f m
[PROOF STEP]
using that decseqD[OF mono', of "m - 1" "n - 1"]
[PROOF STATE]
proof (prove)
using this:
decseq (\<lambda>n. f (Suc n))
m \<le> n
0 < m
m - 1 \<le> n - 1 \<Longrightarrow> f (Suc (n - 1)) \<le> f (Suc (m - 1))

goal (1 subgoal):
 1. f n \<le> f m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?m \<le> ?n; 0 < ?m\<rbrakk> \<Longrightarrow> f ?n \<le> f ?m

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "(\<lambda>n. f (Suc n)) = (\<lambda>n. f' (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n)) = (\<lambda>n. f' (Suc n))
[PROOF STEP]
by (intro ext) (simp add: f'_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (Suc n)) = (\<lambda>n. f' (Suc n))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
hence "summable f \<longleftrightarrow> summable f'"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. f (Suc n)) = (\<lambda>n. f' (Suc n))

goal (1 subgoal):
 1. summable f = summable f'
[PROOF STEP]
by (subst (1 2) summable_Suc_iff [symmetric]) (simp only:)
[PROOF STATE]
proof (state)
this:
summable f = summable f'

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
summable f = summable f'

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> convergent (\<lambda>n. \<Sum>k<n. f' k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f' = convergent (\<lambda>n. sum f' {..<n})
[PROOF STEP]
unfolding summable_iff_convergent
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. sum f' {..<n}) = convergent (\<lambda>n. sum f' {..<n})
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
summable f' = convergent (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
summable f' = convergent (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "monoseq (\<lambda>n. \<Sum>k<n. f' k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. sum f' {..<n})
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. \<Sum>k<n. if k = 0 then 0 else f k)
[PROOF STEP]
by (intro mono_SucI1) (auto intro!: mult_nonneg_nonneg nonneg)
[PROOF STATE]
proof (state)
this:
monoseq (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
hence "convergent (\<lambda>n. \<Sum>k<n. f' k) \<longleftrightarrow> Bseq (\<lambda>n. \<Sum>k<n. f' k)"
[PROOF STATE]
proof (prove)
using this:
monoseq (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. convergent (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {..<n})
[PROOF STEP]
by (rule monoseq_imp_convergent_iff_Bseq)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> Bseq (\<lambda>n. \<Sum>k=1..<n. f' k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {1..<n})
[PROOF STEP]
unfolding One_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {Suc 0..<n})
[PROOF STEP]
by (subst sum_shift_lb_Suc0_0_upt) (simp_all add: f'_def atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {1..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f' {..<n}) = Bseq (\<lambda>n. sum f' {1..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> Bseq (\<lambda>n. \<Sum>k=1..<n. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f' {1..<n}) = Bseq (\<lambda>n. sum f {1..<n})
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k = 1..<n. if k = 0 then 0 else f k) = Bseq (\<lambda>n. sum f {1..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f' {1..<n}) = Bseq (\<lambda>n. sum f {1..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f' {1..<n}) = Bseq (\<lambda>n. sum f {1..<n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> Bseq (\<lambda>n. \<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f {1..<n}) = Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
by (rule nonneg_incseq_Bseq_subseq_iff[symmetric])
       (auto intro!: sum_nonneg incseq_SucI nonneg simp: strict_mono_def)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<n}) = Bseq (\<lambda>n. sum f {1..<2 ^ n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<n}) = Bseq (\<lambda>n. sum f {1..<2 ^ n})

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2^k * f (2^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) = Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
proof (intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
assume A: "Bseq (\<lambda>n. \<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<2 ^ n})

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
have "eventually (\<lambda>n. norm (\<Sum>k<n. 2^k * f (2^Suc k)) \<le> norm (\<Sum>k=1..<2^n. f k)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})
[PROOF STEP]
proof (intro always_eventually allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
have "norm (\<Sum>k<n. 2^k * f (2^Suc k)) = (\<Sum>k<n. 2^k * f (2^Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) = (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k))
[PROOF STEP]
unfolding real_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)\<bar> = (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k))
[PROOF STEP]
by (intro abs_of_nonneg sum_nonneg ballI mult_nonneg_nonneg nonneg) simp_all
[PROOF STATE]
proof (state)
this:
norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) = (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k))

goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) = (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k))

goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
have "\<dots> \<le> (\<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> sum f {1..<2 ^ n}
[PROOF STEP]
by (subst condensation_condense2 [symmetric]) (intro condensation_inequality mono')
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> sum f {1..<2 ^ n}

goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> sum f {1..<2 ^ n}

goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
have "\<dots> = norm \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1..<2 ^ n} = norm (sum f {1..<2 ^ n})
[PROOF STEP]
unfolding real_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1..<2 ^ n} = \<bar>sum f {1..<2 ^ n}\<bar>
[PROOF STEP]
by (intro abs_of_nonneg[symmetric] sum_nonneg ballI mult_nonneg_nonneg nonneg)
[PROOF STATE]
proof (state)
this:
sum f {1..<2 ^ n} = norm (sum f {1..<2 ^ n})

goal (1 subgoal):
 1. \<And>x. norm (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ x})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})
[PROOF STEP]
show "norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (\<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})

goal (1 subgoal):
 1. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
from this and A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})
Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
have "Bseq (\<lambda>n. \<Sum>k<n. 2^k * f (2^Suc k))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. norm (\<Sum>k<n. 2 ^ k * f (2 ^ Suc k)) \<le> norm (sum f {1..<2 ^ n})
Bseq (\<lambda>n. sum f {1..<2 ^ n})

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ Suc k))
[PROOF STEP]
by (rule Bseq_eventually_mono)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ Suc k))

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
from Bseq_mult[OF Bfun_const[of 2] this]
[PROOF STATE]
proof (chain)
picking this:
Bseq (\<lambda>x. 2 * (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)))
[PROOF STEP]
have "Bseq (\<lambda>n. \<Sum>k<n. 2^Suc k * f (2^Suc k))"
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>x. 2 * (\<Sum>k<x. 2 ^ k * f (2 ^ Suc k)))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ Suc k * f (2 ^ Suc k))
[PROOF STEP]
by (simp add: sum_distrib_left sum_distrib_right mult_ac)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ Suc k * f (2 ^ Suc k))

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
hence "Bseq (\<lambda>n. (\<Sum>k=Suc 0..<Suc n. 2^k * f (2^k)) + f 1)"
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ Suc k * f (2 ^ Suc k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. (\<Sum>k = Suc 0..<Suc n. 2 ^ k * f (2 ^ k)) + f 1)
[PROOF STEP]
by (intro Bseq_add, subst sum.shift_bounds_Suc_ivl) (simp add: atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. (\<Sum>k = Suc 0..<Suc n. 2 ^ k * f (2 ^ k)) + f 1)

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
hence "Bseq (\<lambda>n. (\<Sum>k=0..<Suc n. 2^k * f (2^k)))"
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>n. (\<Sum>k = Suc 0..<Suc n. 2 ^ k * f (2 ^ k)) + f 1)

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k = 0..<Suc n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (subst sum.atLeast_Suc_lessThan) (simp_all add: add_ac)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k = 0..<Suc n. 2 ^ k * f (2 ^ k))

goal (2 subgoals):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n}) \<Longrightarrow> Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
 2. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
thus "Bseq (\<lambda>n. (\<Sum>k<n. 2^k * f (2^k)))"
[PROOF STATE]
proof (prove)
using this:
Bseq (\<lambda>n. \<Sum>k = 0..<Suc n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (subst (asm) Bseq_Suc_iff) (simp add: atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
assume A: "Bseq (\<lambda>n. (\<Sum>k<n. 2^k * f (2^k)))"
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
have "eventually (\<lambda>n. norm (\<Sum>k=1..<2^n. f k) \<le> norm (\<Sum>k<n. 2^k * f (2^k))) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
proof (intro always_eventually allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
have "norm (\<Sum>k=1..<2^n. f k) = (\<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (sum f {1..<2 ^ n}) = sum f {1..<2 ^ n}
[PROOF STEP]
unfolding real_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sum f {1..<2 ^ n}\<bar> = sum f {1..<2 ^ n}
[PROOF STEP]
by (intro abs_of_nonneg sum_nonneg ballI mult_nonneg_nonneg nonneg)
[PROOF STATE]
proof (state)
this:
norm (sum f {1..<2 ^ n}) = sum f {1..<2 ^ n}

goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (sum f {1..<2 ^ n}) = sum f {1..<2 ^ n}

goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>k<n. 2^k * f (2^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1..<2 ^ n} \<le> (\<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (subst condensation_condense1 [symmetric]) (intro condensation_inequality mono')
[PROOF STATE]
proof (state)
this:
sum f {1..<2 ^ n} \<le> (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {1..<2 ^ n} \<le> (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
have "\<dots> = norm \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. 2 ^ k * f (2 ^ k)) = norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
unfolding real_norm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n. 2 ^ k * f (2 ^ k)) = \<bar>\<Sum>k<n. 2 ^ k * f (2 ^ k)\<bar>
[PROOF STEP]
by (intro abs_of_nonneg [symmetric] sum_nonneg ballI mult_nonneg_nonneg nonneg) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n. 2 ^ k * f (2 ^ k)) = norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. \<And>x. norm (sum f {1..<2 ^ x}) \<le> norm (\<Sum>k<x. 2 ^ k * f (2 ^ k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
show "norm (\<Sum>k=1..<2^n. f k) \<le> norm (\<Sum>k<n. 2^k * f (2^k))"
[PROOF STATE]
proof (prove)
using this:
norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) \<Longrightarrow> Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
from this and A
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
show "Bseq (\<lambda>n. \<Sum>k=1..<2^n. f k)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. norm (sum f {1..<2 ^ n}) \<le> norm (\<Sum>k<n. 2 ^ k * f (2 ^ k))
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. sum f {1..<2 ^ n})
[PROOF STEP]
by (rule Bseq_eventually_mono)
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<2 ^ n})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<2 ^ n}) = Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. sum f {1..<2 ^ n}) = Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "monoseq (\<lambda>n. (\<Sum>k<n. 2^k * f (2^k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (intro mono_SucI1) (auto intro!: mult_nonneg_nonneg nonneg)
[PROOF STATE]
proof (state)
this:
monoseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
hence "Bseq (\<lambda>n. (\<Sum>k<n. 2^k * f (2^k))) \<longleftrightarrow> convergent (\<lambda>n. (\<Sum>k<n. 2^k * f (2^k)))"
[PROOF STATE]
proof (prove)
using this:
monoseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) = convergent (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (rule monoseq_imp_convergent_iff_Bseq [symmetric])
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) = convergent (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) = convergent (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
have "\<dots> \<longleftrightarrow> summable (\<lambda>k. 2^k * f (2^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) = summable (\<lambda>k. 2 ^ k * f (2 ^ k))
[PROOF STEP]
by (simp only: summable_iff_convergent)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. \<Sum>k<n. 2 ^ k * f (2 ^ k)) = summable (\<lambda>k. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
summable f = summable (\<lambda>k. 2 ^ k * f (2 ^ k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
summable f = summable (\<lambda>k. 2 ^ k * f (2 ^ k))

goal (1 subgoal):
 1. summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
summable f = summable (\<lambda>n. 2 ^ n * f (2 ^ n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arg_complex_of_real_positive [simp]:
  assumes "k > 0"
  shows "Arg (cor k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cor k) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg (cor k) = 0
[PROOF STEP]
have "cos (Arg (Complex k 0)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < cos (Arg (Complex k 0))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. 0 < cos (Arg (Complex k 0))
[PROOF STEP]
using rcis_cmod_Arg[of "Complex k 0"] Re_rcis[of "cmod (Complex k 0)" "Arg (Complex k 0)"]
[PROOF STATE]
proof (prove)
using this:
0 < k
rcis (cmod (Complex k 0)) (Arg (Complex k 0)) = Complex k 0
Re (rcis (cmod (Complex k 0)) (Arg (Complex k 0))) = cmod (Complex k 0) * cos (Arg (Complex k 0))

goal (1 subgoal):
 1. 0 < cos (Arg (Complex k 0))
[PROOF STEP]
using cmod_eq_Re
[PROOF STATE]
proof (prove)
using this:
0 < k
rcis (cmod (Complex k 0)) (Arg (Complex k 0)) = Complex k 0
Re (rcis (cmod (Complex k 0)) (Arg (Complex k 0))) = cmod (Complex k 0) * cos (Arg (Complex k 0))
is_real ?z \<Longrightarrow> cmod ?z = \<bar>Re ?z\<bar>

goal (1 subgoal):
 1. 0 < cos (Arg (Complex k 0))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < cos (Arg (Complex k 0))

goal (1 subgoal):
 1. Arg (cor k) = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < cos (Arg (Complex k 0))

goal (1 subgoal):
 1. Arg (cor k) = 0
[PROOF STEP]
using assms is_real_arg2[of "cor k"]
[PROOF STATE]
proof (prove)
using this:
0 < cos (Arg (Complex k 0))
0 < k
is_real (cor k) \<Longrightarrow> Arg (cor k) = 0 \<or> Arg (cor k) = pi

goal (1 subgoal):
 1. Arg (cor k) = 0
[PROOF STEP]
unfolding complex_of_real_def
[PROOF STATE]
proof (prove)
using this:
0 < cos (Arg (Complex k 0))
0 < k
is_real (Complex k 0) \<Longrightarrow> Arg (Complex k 0) = 0 \<or> Arg (Complex k 0) = pi

goal (1 subgoal):
 1. Arg (Complex k 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Arg (cor k) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fds_altdef:
  assumes "fds_abs_converges f s"
  shows   "eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)
[PROOF STEP]
have "fds_abs_converges f s \<longleftrightarrow> (\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_abs_converges f s = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)
[PROOF STEP]
unfolding fds_abs_converges_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on {1..}) = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)
[PROOF STEP]
by (intro abs_summable_on_cong_neutral) (auto simp: Suc_le_eq)
[PROOF STATE]
proof (state)
this:
fds_abs_converges f s = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)

goal (1 subgoal):
 1. eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
fds_abs_converges f s
fds_abs_converges f s = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fds_abs_converges f s
fds_abs_converges f s = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)

goal (1 subgoal):
 1. eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)
[PROOF STEP]
unfolding eval_fds_def fds_abs_converges_altdef
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on {1..}
((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on {1..}) = ((\<lambda>n. fds_nth f n / nat_power n s) abs_summable_on UNIV)

goal (1 subgoal):
 1. (\<Sum>n. fds_nth f n / nat_power n s) = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)
[PROOF STEP]
by (intro infsetsum_nat' [symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
eval_fds f s = (\<Sum>\<^sub>an. fds_nth f n / nat_power n s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_less_prodinf2:
  fixes f :: "nat \<Rightarrow> real"
  assumes f: "convergent_prod f" and 1: "\<And>m. m\<ge>n \<Longrightarrow> 1 \<le> f m" and 0: "\<And>m. 0 < f m" and i: "n \<le> i" "1 < f i"
  shows "prod f {..<n} < prodinf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
have "prod f {..<n} \<le> prod f {..<i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<n} \<le> prod f {..<i}
[PROOF STEP]
by (rule prod_mono2) (use assms less_le in auto)
[PROOF STATE]
proof (state)
this:
prod f {..<n} \<le> prod f {..<i}

goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prod f {..<n} \<le> prod f {..<i}
[PROOF STEP]
have "prod f {..<n} < f i * prod f {..<i}"
[PROOF STATE]
proof (prove)
using this:
prod f {..<n} \<le> prod f {..<i}

goal (1 subgoal):
 1. prod f {..<n} < f i * prod f {..<i}
[PROOF STEP]
using mult_less_le_imp_less[of 1 "f i" "prod f {..<n}" "prod f {..<i}"] assms
[PROOF STATE]
proof (prove)
using this:
prod f {..<n} \<le> prod f {..<i}
\<lbrakk>1 < f i; prod f {..<n} \<le> prod f {..<i}; 0 \<le> 1; 0 < prod f {..<n}\<rbrakk> \<Longrightarrow> 1 * prod f {..<n} < f i * prod f {..<i}
convergent_prod f
n \<le> ?m \<Longrightarrow> 1 \<le> f ?m
0 < f ?m
n \<le> i
1 < f i

goal (1 subgoal):
 1. prod f {..<n} < f i * prod f {..<i}
[PROOF STEP]
by (simp add: prod_pos)
[PROOF STATE]
proof (state)
this:
prod f {..<n} < f i * prod f {..<i}

goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
prod f {..<n} < f i * prod f {..<i}

goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
have "prod f {..<Suc i} \<le> prodinf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<Suc i} \<le> prodinf f
[PROOF STEP]
using prod_le_prodinf[of f _ "Suc i"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f has_prod ?a; \<And>i. 0 \<le> f i; \<And>ia. Suc i \<le> ia \<Longrightarrow> 1 \<le> f ia\<rbrakk> \<Longrightarrow> prod f {..<Suc i} \<le> prodinf f

goal (1 subgoal):
 1. prod f {..<Suc i} \<le> prodinf f
[PROOF STEP]
by (meson "0" "1" Suc_leD convergent_prod_has_prod f \<open>n \<le> i\<close> le_trans less_eq_real_def)
[PROOF STATE]
proof (state)
this:
prod f {..<Suc i} \<le> prodinf f

goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
prod f {..<n} < f i * prod f {..<i}
prod f {..<Suc i} \<le> prodinf f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod f {..<n} < f i * prod f {..<i}
prod f {..<Suc i} \<le> prodinf f

goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
by (metis le_less_trans mult.commute not_le prod.lessThan_Suc)
[PROOF STATE]
proof (state)
this:
prod f {..<n} < prodinf f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_all_edges_between:
  assumes "finite Y"
  shows "card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
have "all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})
[PROOF STEP]
by (auto simp: all_edges_between_def)
[PROOF STATE]
proof (state)
this:
all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})

goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})

goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
have "disjoint_family_on (\<lambda>y. all_edges_between X {y}) Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on (\<lambda>y. all_edges_between X {y}) Y
[PROOF STEP]
unfolding disjoint_family_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m\<in>Y. \<forall>n\<in>Y. m \<noteq> n \<longrightarrow> all_edges_between X {m} \<inter> all_edges_between X {n} = {}
[PROOF STEP]
by (auto simp: disjoint_family_on_def all_edges_between_def)
[PROOF STATE]
proof (state)
this:
disjoint_family_on (\<lambda>y. all_edges_between X {y}) Y

goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})
disjoint_family_on (\<lambda>y. all_edges_between X {y}) Y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
all_edges_between X Y = (\<Union>y\<in>Y. all_edges_between X {y})
disjoint_family_on (\<lambda>y. all_edges_between X {y}) Y

goal (1 subgoal):
 1. card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))
[PROOF STEP]
by (simp add: card_UN_disjoint' assms finite_all_edges_between')
[PROOF STATE]
proof (state)
this:
card (all_edges_between X Y) = (\<Sum>y\<in>Y. card (all_edges_between X {y}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lemNullLine:
    assumes "direction lineA = vecZero"
      and   "inLine x lineA"
    shows   "x = basepoint lineA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
define bp where "bp = basepoint lineA"
[PROOF STATE]
proof (state)
this:
bp = basepoint lineA

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
have "collinear x (basepoint lineA) (basepoint lineA \<leadsto> direction lineA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear x (basepoint lineA) (basepoint lineA \<leadsto> direction lineA)
[PROOF STEP]
by (metis inLine.simps assms(2))
[PROOF STATE]
proof (state)
this:
collinear x (basepoint lineA) (basepoint lineA \<leadsto> direction lineA)

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
hence "collinear x bp (bp \<leadsto> vecZero)"
[PROOF STATE]
proof (prove)
using this:
collinear x (basepoint lineA) (basepoint lineA \<leadsto> direction lineA)

goal (1 subgoal):
 1. collinear x bp (bp \<leadsto> 0)
[PROOF STEP]
by (metis bp_def  assms(1))
[PROOF STATE]
proof (state)
this:
collinear x bp (bp \<leadsto> 0)

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
hence "collinear x bp bp"
[PROOF STATE]
proof (prove)
using this:
collinear x bp (bp \<leadsto> 0)

goal (1 subgoal):
 1. collinear x bp bp
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
collinear x bp bp

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
hence "\<exists>a b.( (a + b = 1) \<and>
                  (positionVector x = a**(positionVector bp) \<oplus> b**(positionVector bp)) )"
[PROOF STATE]
proof (prove)
using this:
collinear x bp bp

goal (1 subgoal):
 1. \<exists>a b. a + b = (1::'a) \<and> positionVector x = a ** positionVector bp \<oplus> b ** positionVector bp
[PROOF STEP]
by (metis collinear.simps)
[PROOF STATE]
proof (state)
this:
\<exists>a b. a + b = (1::'a) \<and> positionVector x = a ** positionVector bp \<oplus> b ** positionVector bp

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
hence "positionVector x = positionVector bp"
[PROOF STATE]
proof (prove)
using this:
\<exists>a b. a + b = (1::'a) \<and> positionVector x = a ** positionVector bp \<oplus> b ** positionVector bp

goal (1 subgoal):
 1. positionVector x = positionVector bp
[PROOF STEP]
by (metis lemScale1 lemAddOverScale)
[PROOF STATE]
proof (state)
this:
positionVector x = positionVector bp

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
positionVector x = positionVector bp

goal (1 subgoal):
 1. x = basepoint lineA
[PROOF STEP]
by (simp add: bp_def)
[PROOF STATE]
proof (state)
this:
x = basepoint lineA

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primepow_multD:
  assumes "primepow (a * b :: nat)"
  shows   "a = 1 \<or> primepow a" "b = 1 \<or> primepow b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = 1 \<or> primepow a &&& b = 1 \<or> primepow b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 1 \<or> primepow a
 2. b = 1 \<or> primepow b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
primepow (a * b)
[PROOF STEP]
obtain p k where k: "k > 0" "a * b = p ^ k" "prime p"
[PROOF STATE]
proof (prove)
using this:
primepow (a * b)

goal (1 subgoal):
 1. (\<And>k p. \<lbrakk>0 < k; a * b = p ^ k; prime p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding primepow_def
[PROOF STATE]
proof (prove)
using this:
\<exists>p k. prime p \<and> 0 < k \<and> a * b = p ^ k

goal (1 subgoal):
 1. (\<And>k p. \<lbrakk>0 < k; a * b = p ^ k; prime p\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < k
a * b = p ^ k
prime p

goal (2 subgoals):
 1. a = 1 \<or> primepow a
 2. b = 1 \<or> primepow b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < k
a * b = p ^ k
prime p
[PROOF STEP]
obtain i j where "a = p ^ i" "b = p ^ j"
[PROOF STATE]
proof (prove)
using this:
0 < k
a * b = p ^ k
prime p

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>a = p ^ i; b = p ^ j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using prime_power_mult_nat[of p a b]
[PROOF STATE]
proof (prove)
using this:
0 < k
a * b = p ^ k
prime p
\<lbrakk>prime p; a * b = p ^ ?k\<rbrakk> \<Longrightarrow> \<exists>i j. a = p ^ i \<and> b = p ^ j

goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>a = p ^ i; b = p ^ j\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a = p ^ i
b = p ^ j

goal (2 subgoals):
 1. a = 1 \<or> primepow a
 2. b = 1 \<or> primepow b
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
a = p ^ i
b = p ^ j
[PROOF STEP]
show "a = 1 \<or> primepow a" "b = 1 \<or> primepow b"
[PROOF STATE]
proof (prove)
using this:
prime p
a = p ^ i
b = p ^ j

goal (1 subgoal):
 1. a = 1 \<or> primepow a &&& b = 1 \<or> primepow b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = 1 \<or> primepow a
b = 1 \<or> primepow b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma limpt_of_limpts: "x islimpt {y. y islimpt S} \<Longrightarrow> x islimpt S"
  for x :: "'a::metric_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt {y. y islimpt S} \<Longrightarrow> x islimpt S
[PROOF STEP]
apply (clarsimp simp add: islimpt_approachable)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>x'. (\<forall>e>0. \<exists>x'a\<in>S. x'a \<noteq> x' \<and> dist x'a x' < e) \<and> x' \<noteq> x \<and> dist x' x < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e
[PROOF STEP]
apply (drule_tac x="e/2" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>0 < e; 0 < e / 2 \<longrightarrow> (\<exists>x'. (\<forall>e>0. \<exists>x'a\<in>S. x'a \<noteq> x' \<and> dist x'a x' < e) \<and> x' \<noteq> x \<and> dist x' x < e / 2)\<rbrakk> \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e
[PROOF STEP]
apply (auto simp: simp del: less_divide_eq_numeral1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e x'. \<lbrakk>0 < e; \<forall>e>0. \<exists>x'a\<in>S. x'a \<noteq> x' \<and> dist x'a x' < e; x' \<noteq> x; dist x' x < e / 2\<rbrakk> \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e
[PROOF STEP]
apply (drule_tac x="dist x' x" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e x'. \<lbrakk>0 < e; x' \<noteq> x; dist x' x < e / 2; 0 < dist x' x \<longrightarrow> (\<exists>x'a\<in>S. x'a \<noteq> x' \<and> dist x'a x' < dist x' x)\<rbrakk> \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e
[PROOF STEP]
apply (auto simp del: less_divide_eq_numeral1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e x' x'a. \<lbrakk>0 < e; x' \<noteq> x; dist x' x < e / 2; x'a \<in> S; x'a \<noteq> x'; dist x'a x' < dist x' x\<rbrakk> \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e
[PROOF STEP]
apply metric
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma plus_vec0[simp]: assumes "vec nr u" shows "vec_plus u (vec0 nr) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_plus u (vec0 nr) = u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vec nr u

goal (1 subgoal):
 1. vec_plus u (vec0 nr) = u
[PROOF STEP]
unfolding vec_def vec_plusI_def vec0I_def
[PROOF STATE]
proof (prove)
using this:
length u = nr

goal (1 subgoal):
 1. map (\<lambda>xy. fst xy + snd xy) (zip u (replicate nr (0::'a))) = u
[PROOF STEP]
proof (induct nr arbitrary: u)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate 0 (0::'a))) = u
 2. \<And>nr u. \<lbrakk>\<And>u. length u = nr \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate nr (0::'a))) = u; length u = Suc nr\<rbrakk> \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate (Suc nr) (0::'a))) = u
[PROOF STEP]
case (Suc nn)
[PROOF STATE]
proof (state)
this:
length ?u = nn \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip ?u (replicate nn (0::'a))) = ?u
length u = Suc nn

goal (2 subgoals):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate 0 (0::'a))) = u
 2. \<And>nr u. \<lbrakk>\<And>u. length u = nr \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate nr (0::'a))) = u; length u = Suc nr\<rbrakk> \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate (Suc nr) (0::'a))) = u
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length ?u = nn \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip ?u (replicate nn (0::'a))) = ?u
length u = Suc nn

goal (1 subgoal):
 1. map (\<lambda>xy. fst xy + snd xy) (zip u (replicate (Suc nn) (0::'a))) = u
[PROOF STEP]
by (cases u, auto)
[PROOF STATE]
proof (state)
this:
map (\<lambda>xy. fst xy + snd xy) (zip u (replicate (Suc nn) (0::'a))) = u

goal (1 subgoal):
 1. \<And>u. length u = 0 \<Longrightarrow> map (\<lambda>xy. fst xy + snd xy) (zip u (replicate 0 (0::'a))) = u
[PROOF STEP]
qed simp


[STATEMENT]
lemma closure_sum:
  fixes S T :: "'a::real_normed_vector set"
  shows "closure S + closure T \<subseteq> closure (S + T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure S + closure T \<subseteq> closure (S + T)
[PROOF STEP]
unfolding set_plus_image closure_Times [symmetric] split_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. fst p + snd p) ` closure (S \<times> T) \<subseteq> closure ((\<lambda>p. fst p + snd p) ` (S \<times> T))
[PROOF STEP]
by (intro closure_bounded_linear_image_subset bounded_linear_add
    bounded_linear_fst bounded_linear_snd)


[STATEMENT]
lemma card_mono_strict_subset:
  "finite A \<Longrightarrow> finite B \<Longrightarrow> finite C \<Longrightarrow> A \<inter> B \<noteq> {} \<Longrightarrow> C = A - B \<Longrightarrow> card C < card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; finite C; A \<inter> B \<noteq> {}; C = A - B\<rbrakk> \<Longrightarrow> card C < card A
[PROOF STEP]
by (metis Diff_disjoint Diff_subset inf_commute less_le psubset_card_mono)


[STATEMENT]
lemma bounded_degree_polynomials_length:
  "bounded_degree_polynomials F n = {x. x \<in> carrier (poly_ring F) \<and> length x \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_degree_polynomials F n = {x \<in> carrier (poly_ring F). length x \<le> n}
[PROOF STEP]
unfolding bounded_degree_polynomials_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (poly_ring F). degree x < n \<or> x = []} = {x \<in> carrier (poly_ring F). length x \<le> n}
[PROOF STEP]
using leI order_less_le_trans
[PROOF STATE]
proof (prove)
using this:
\<not> ?x < ?y \<Longrightarrow> ?y \<le> ?x
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. {x \<in> carrier (poly_ring F). degree x < n \<or> x = []} = {x \<in> carrier (poly_ring F). length x \<le> n}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma pr_index_enumerator_mono1: "n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
assume A: "n1 < n2"
[PROOF STATE]
proof (state)
this:
n1 < n2

goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
define f where "f x = pr_index_enumerator x m" for x
[PROOF STATE]
proof (state)
this:
f ?x = pr_index_enumerator ?x m

goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
have f_inc: "\<forall> x. f x < f (x+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x < f (x + 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x < f (x + 1)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. f x < f (x + 1)
[PROOF STEP]
show "f x < f (x+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x < f (x + 1)
[PROOF STEP]
by (unfold f_def, rule pr_index_enumerator_increase1)
[PROOF STATE]
proof (state)
this:
f x < f (x + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. f x < f (x + 1)

goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
from f_inc
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. f x < f (x + 1)
[PROOF STEP]
have "\<forall> x y. (x < y \<longrightarrow> f x < f y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. f x < f (x + 1)

goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
by (rule f_inc_mono)
[PROOF STATE]
proof (state)
this:
\<forall>x y. x < y \<longrightarrow> f x < f y

goal (1 subgoal):
 1. n1 < n2 \<Longrightarrow> pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
with A f_def
[PROOF STATE]
proof (chain)
picking this:
n1 < n2
f ?x = pr_index_enumerator ?x m
\<forall>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n1 < n2
f ?x = pr_index_enumerator ?x m
\<forall>x y. x < y \<longrightarrow> f x < f y

goal (1 subgoal):
 1. pr_index_enumerator n1 m < pr_index_enumerator n2 m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n1 m < pr_index_enumerator n2 m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma times_mtx3: "mtx
  ([a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3] #
   [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3] #
   [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3] # []) * mtx
  ([b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3] #
   [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3] #
   [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3] # []) = (mtx
  ([a\<^sub>1\<^sub>1*b\<^sub>1\<^sub>1+a\<^sub>1\<^sub>2*b\<^sub>2\<^sub>1+a\<^sub>1\<^sub>3*b\<^sub>3\<^sub>1, a\<^sub>1\<^sub>1*b\<^sub>1\<^sub>2+a\<^sub>1\<^sub>2*b\<^sub>2\<^sub>2+a\<^sub>1\<^sub>3*b\<^sub>3\<^sub>2, a\<^sub>1\<^sub>1*b\<^sub>1\<^sub>3+a\<^sub>1\<^sub>2*b\<^sub>2\<^sub>3+a\<^sub>1\<^sub>3*b\<^sub>3\<^sub>3] #
   [a\<^sub>2\<^sub>1*b\<^sub>1\<^sub>1+a\<^sub>2\<^sub>2*b\<^sub>2\<^sub>1+a\<^sub>2\<^sub>3*b\<^sub>3\<^sub>1, a\<^sub>2\<^sub>1*b\<^sub>1\<^sub>2+a\<^sub>2\<^sub>2*b\<^sub>2\<^sub>2+a\<^sub>2\<^sub>3*b\<^sub>3\<^sub>2, a\<^sub>2\<^sub>1*b\<^sub>1\<^sub>3+a\<^sub>2\<^sub>2*b\<^sub>2\<^sub>3+a\<^sub>2\<^sub>3*b\<^sub>3\<^sub>3] #
   [a\<^sub>3\<^sub>1*b\<^sub>1\<^sub>1+a\<^sub>3\<^sub>2*b\<^sub>2\<^sub>1+a\<^sub>3\<^sub>3*b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>1*b\<^sub>1\<^sub>2+a\<^sub>3\<^sub>2*b\<^sub>2\<^sub>2+a\<^sub>3\<^sub>3*b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>1*b\<^sub>1\<^sub>3+a\<^sub>3\<^sub>2*b\<^sub>2\<^sub>3+a\<^sub>3\<^sub>3*b\<^sub>3\<^sub>3] # [])::3 sq_mtx)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtx [[a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3]] * mtx [[b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3], [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3], [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3]] = mtx [[a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>3]]
[PROOF STEP]
unfolding sq_mtx_times_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_mtx (\<chi>i j. \<Sum>k\<in>UNIV. mtx [[a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3]] $$ i $ k * mtx [[b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3], [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3], [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3]] $$ k $ j) = mtx [[a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>3]]
[PROOF STEP]
unfolding UNIV_3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_mtx (\<chi>i j. \<Sum>k\<in>{1, 2, 3}. mtx [[a\<^sub>1\<^sub>1, a\<^sub>1\<^sub>2, a\<^sub>1\<^sub>3], [a\<^sub>2\<^sub>1, a\<^sub>2\<^sub>2, a\<^sub>2\<^sub>3], [a\<^sub>3\<^sub>1, a\<^sub>3\<^sub>2, a\<^sub>3\<^sub>3]] $$ i $ k * mtx [[b\<^sub>1\<^sub>1, b\<^sub>1\<^sub>2, b\<^sub>1\<^sub>3], [b\<^sub>2\<^sub>1, b\<^sub>2\<^sub>2, b\<^sub>2\<^sub>3], [b\<^sub>3\<^sub>1, b\<^sub>3\<^sub>2, b\<^sub>3\<^sub>3]] $$ k $ j) = mtx [[a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>1\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>1\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>1\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>2\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>2\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>2\<^sub>3 * b\<^sub>3\<^sub>3], [a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>1 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>1 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>1, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>2 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>2 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>2, a\<^sub>3\<^sub>1 * b\<^sub>1\<^sub>3 + a\<^sub>3\<^sub>2 * b\<^sub>2\<^sub>3 + a\<^sub>3\<^sub>3 * b\<^sub>3\<^sub>3]]
[PROOF STEP]
by (simp add: sq_mtx_eq_iff)


[STATEMENT]
lemma sigma_sets_singletons_and_empty:
  assumes "countable M"
  shows "sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
have "sigma_sets M ((\<lambda>k. {k}) ` M) = Pow M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets M ((\<lambda>k. {k}) ` M) = Pow M
[PROOF STEP]
using assms sigma_sets_singletons
[PROOF STATE]
proof (prove)
using this:
countable M
countable ?S \<Longrightarrow> sigma_sets ?S ((\<lambda>s. {s}) ` ?S) = Pow ?S

goal (1 subgoal):
 1. sigma_sets M ((\<lambda>k. {k}) ` M) = Pow M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sigma_sets M ((\<lambda>k. {k}) ` M) = Pow M

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
hence "Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))"
[PROOF STATE]
proof (prove)
using this:
sigma_sets M ((\<lambda>k. {k}) ` M) = Pow M

goal (1 subgoal):
 1. Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))
[PROOF STEP]
by (metis sigma_sets_subseteq subset_insertI)
[PROOF STATE]
proof (state)
this:
Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
have "(insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert {} ((\<lambda>k. {k}) ` M) \<subseteq> Pow M
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
insert {} ((\<lambda>k. {k}) ` M) \<subseteq> Pow M

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
hence "sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M"
[PROOF STATE]
proof (prove)
using this:
insert {} ((\<lambda>k. {k}) ` M) \<subseteq> Pow M

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M
[PROOF STEP]
by (meson sigma_algebra.sigma_sets_subset sigma_algebra_Pow)
[PROOF STATE]
proof (state)
this:
sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))
sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Pow M \<subseteq> sigma_sets M (insert {} ((\<lambda>k. {k}) ` M))
sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) \<subseteq> Pow M

goal (1 subgoal):
 1. sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sigma_sets M (insert {} ((\<lambda>k. {k}) ` M)) = Pow M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upper_bound2:
  fixes b::nat
      and c::int
    assumes "b > 0"
      and "c < 2^b"
      and "c \<ge> 0"
    shows "c - (2^(b-1)) < 2^(b-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
have a1: "\<And>P. (\<forall>b::nat. P b) \<Longrightarrow> (\<forall>b>0. P ((b-1)::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<forall>b. P b \<Longrightarrow> \<forall>b>0. P (b - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b. ?P b \<Longrightarrow> \<forall>b>0. ?P (b - 1)

goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
have b2: "\<forall>b::nat. (\<forall>(c::int)<2^(Suc b). c\<ge>0 \<longrightarrow> (c - 2^b) < 2^b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b c. c < 2 ^ Suc b \<longrightarrow> 0 \<le> c \<longrightarrow> c - 2 ^ b < 2 ^ b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>b c. c < 2 ^ Suc b \<longrightarrow> 0 \<le> c \<longrightarrow> c - 2 ^ b < 2 ^ b

goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
using a1[OF b2] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>b>0. \<forall>c<2 ^ Suc (b - 1). 0 \<le> c \<longrightarrow> c - 2 ^ (b - 1) < 2 ^ (b - 1)
0 < b
c < 2 ^ b
0 \<le> c

goal (1 subgoal):
 1. c - 2 ^ (b - 1) < 2 ^ (b - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c - 2 ^ (b - 1) < 2 ^ (b - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) weak_group_morphism_ker:
  assumes "weak_group_morphism f H G" shows "kernel G (image_group f G) f = H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel G (image_group f G) f = H
[PROOF STEP]
using vimage_eq_rcoset(1)[OF assms one_closed] weak_group_morphism.axioms(1)[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
{b \<in> carrier G. f b = f \<one>} = H #> \<one>
H \<lhd> G

goal (1 subgoal):
 1. kernel G (image_group f G) f = H
[PROOF STEP]
by (simp add: image_group_def kernel_def normal_def subgroup.subset)


[STATEMENT]
lemma roots_of_complex_rf_polys:
  "set (roots_of_complex_rf_polys ps) = {x. \<exists> p \<in> set (polys_rf ps). poly (poly_rf p) x = 0 }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (roots_of_complex_rf_polys ps) = {x. \<exists>p\<in>set (polys_rf ps). poly (poly_rf p) x = 0}
[PROOF STEP]
unfolding roots_of_complex_rf_polys_def set_concat set_map image_comp o_def
    roots_of_complex_rf_poly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>set (polys_rf ps). {xa. poly (poly_rf x) xa = 0}) = {x. \<exists>p\<in>set (polys_rf ps). poly (poly_rf p) x = 0}
[PROOF STEP]
by auto


[STATEMENT]
lemma Holder_inequality_sum:
  assumes "p > (0::real)" "q > 0" "1/p + 1/q = 1"
  assumes "finite A"
  shows "\<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1/p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1/q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
have "\<bar>LINT x|count_space A. f x * g x\<bar> \<le>
    (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) *
    (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>LINT x|count_space A. f x * g x\<bar> \<le> (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) * (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
using assms integrable_count_space
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < q
1 / p + 1 / q = 1
finite A
finite ?X \<Longrightarrow> integrable (count_space ?X) ?f

goal (1 subgoal):
 1. \<bar>LINT x|count_space A. f x * g x\<bar> \<le> (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) * (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
by (intro Lp.Holder_inequality, auto)
[PROOF STATE]
proof (state)
this:
\<bar>LINT x|count_space A. f x * g x\<bar> \<le> (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) * (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)

goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>LINT x|count_space A. f x * g x\<bar> \<le> (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) * (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)

goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<bar>LINT x|count_space A. f x * g x\<bar> \<le> (LINT x|count_space A. \<bar>f x\<bar> powr p) powr (1 / p) * (LINT x|count_space A. \<bar>g x\<bar> powr q) powr (1 / q)
0 < p
0 < q
1 / p + 1 / q = 1
finite A

goal (1 subgoal):
 1. \<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)
[PROOF STEP]
by (simp add: lebesgue_integral_count_space_finite[symmetric])
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>x\<in>A. f x * g x\<bar> \<le> (\<Sum>x\<in>A. \<bar>f x\<bar> powr p) powr (1 / p) * (\<Sum>x\<in>A. \<bar>g x\<bar> powr q) powr (1 / q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_cblinfun_ceuclidean_le:
  fixes a::"'a::ceuclidean_space \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector"
  shows "norm a \<le> sum (\<lambda>x. norm (a x)) CBasis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a \<le> (\<Sum>x\<in>CBasis. norm (cblinfun_apply a x))
[PROOF STEP]
apply (rule norm_cblinfun_bound)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> (\<Sum>x\<in>CBasis. norm (cblinfun_apply a x))
 2. \<And>x. norm (cblinfun_apply a x) \<le> (\<Sum>x\<in>CBasis. norm (cblinfun_apply a x)) * norm x
[PROOF STEP]
apply (simp add: sum_nonneg)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (cblinfun_apply a x) \<le> (\<Sum>x\<in>CBasis. norm (cblinfun_apply a x)) * norm x
[PROOF STEP]
apply (subst ceuclidean_representation[symmetric, where 'a='a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (cblinfun_apply a (\<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C x) *\<^sub>C b)) \<le> (\<Sum>x\<in>CBasis. norm (cblinfun_apply a x)) * norm x
[PROOF STEP]
apply (simp only: cblinfun.cbilinear_simps sum_distrib_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. norm (\<Sum>i\<in>CBasis. (i \<bullet>\<^sub>C x) *\<^sub>C cblinfun_apply a i) \<le> (\<Sum>n\<in>CBasis. norm (cblinfun_apply a n) * norm x)
[PROOF STEP]
apply (rule order.trans[OF norm_sum sum_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. n \<in> CBasis \<Longrightarrow> norm ((n \<bullet>\<^sub>C x) *\<^sub>C cblinfun_apply a n) \<le> norm (cblinfun_apply a n) * norm x
[PROOF STEP]
apply (simp add: abs_mult mult_right_mono ac_simps CBasis_le_norm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x n. n \<in> CBasis \<Longrightarrow> norm (cblinfun_apply a n) * cmod (n \<bullet>\<^sub>C x) \<le> norm x * norm (cblinfun_apply a n)
[PROOF STEP]
by (metis complex_inner_class.Cauchy_Schwarz_ineq2 mult.commute mult.left_neutral mult_right_mono norm_CBasis norm_ge_zero)


[STATEMENT]
lemma hnorm_triangle_ineq4: "\<And>a b::'a::real_normed_vector star. hnorm (a - b) \<le> hnorm a + hnorm b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. hnorm (a - b) \<le> hnorm a + hnorm b
[PROOF STEP]
by transfer (rule norm_triangle_ineq4)


[STATEMENT]
lemma Cauchy_iff: "Cauchy X \<longleftrightarrow> (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e)"
  for X :: "nat \<Rightarrow> 'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e)
[PROOF STEP]
unfolding Cauchy_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e) = (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e)
[PROOF STEP]
..


[STATEMENT]
lemma image_mset_mono:
  assumes
    mono_f: "\<forall>x \<in> set_mset M. \<forall>y \<in> set_mset N. x < y \<longrightarrow> f x < f y" and
    less: "M \<le> N"
  shows "image_mset f M \<le> image_mset f N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f M \<le> image_mset f N
[PROOF STEP]
by (metis eq_iff image_mset_strict_mono less less_imp_le mono_f order.not_eq_order_implies_strict)


[STATEMENT]
lemma connected_nest:
  fixes S :: "'a::linorder \<Rightarrow> 'b::euclidean_space set"
  assumes S: "\<And>n. compact(S n)" "\<And>n. connected(S n)"
    and nest: "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m"
  shows "connected(\<Inter> (range S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected (\<Inter> (range S))
[PROOF STEP]
proof (rule connected_chain)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Sa. Sa \<in> range S \<Longrightarrow> compact Sa \<and> connected Sa
 2. \<And>Sa T. Sa \<in> range S \<and> T \<in> range S \<Longrightarrow> Sa \<subseteq> T \<or> T \<subseteq> Sa
[PROOF STEP]
show "\<And>A T. A \<in> range S \<and> T \<in> range S \<Longrightarrow> A \<subseteq> T \<or> T \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A T. A \<in> range S \<and> T \<in> range S \<Longrightarrow> A \<subseteq> T \<or> T \<subseteq> A
[PROOF STEP]
by (metis image_iff le_cases nest)
[PROOF STATE]
proof (state)
this:
?A \<in> range S \<and> ?T \<in> range S \<Longrightarrow> ?A \<subseteq> ?T \<or> ?T \<subseteq> ?A

goal (1 subgoal):
 1. \<And>Sa. Sa \<in> range S \<Longrightarrow> compact Sa \<and> connected Sa
[PROOF STEP]
qed (use S in blast)


[STATEMENT]
lemma poly_add_assoc: "poly_add p1 (poly_add p2 p3) =p poly_add (poly_add p1 p2) p3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add p1 (poly_add p2 p3) =p poly_add (poly_add p1 p2) p3
[PROOF STEP]
unfolding eq_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<alpha>. eval_poly \<alpha> (poly_add p1 (poly_add p2 p3)) = eval_poly \<alpha> (poly_add (poly_add p1 p2) p3)
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma card_disjoint_shuffles:
  assumes "set xs \<inter> set ys = {}"
  shows   "card (shuffles xs ys) = (length xs + length ys) choose length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (shuffles xs ys) = length xs + length ys choose length xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys = {}

goal (1 subgoal):
 1. card (shuffles xs ys) = length xs + length ys choose length xs
[PROOF STEP]
proof (induction xs ys rule: shuffles.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
case (3 x xs y ys)
[PROOF STATE]
proof (state)
this:
set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs
set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs)
set (x # xs) \<inter> set (y # ys) = {}

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "shuffles (x # xs) (y # ys) = (#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shuffles (x # xs) (y # ys) = (#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys
[PROOF STEP]
by (rule shuffles.simps)
[PROOF STATE]
proof (state)
this:
shuffles (x # xs) (y # ys) = (#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
shuffles (x # xs) (y # ys) = (#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card \<dots> = card ((#) x ` shuffles xs (y # ys)) + card ((#) y ` shuffles (x # xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys) = card ((#) x ` shuffles xs (y # ys)) + card ((#) y ` shuffles (x # xs) ys)
[PROOF STEP]
by (rule card_Un_disjoint) (insert "3.prems", auto)
[PROOF STATE]
proof (state)
this:
card ((#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys) = card ((#) x ` shuffles xs (y # ys)) + card ((#) y ` shuffles (x # xs) ys)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((#) x ` shuffles xs (y # ys) \<union> (#) y ` shuffles (x # xs) ys) = card ((#) x ` shuffles xs (y # ys)) + card ((#) y ` shuffles (x # xs) ys)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card ((#) x ` shuffles xs (y # ys)) = card (shuffles xs (y # ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((#) x ` shuffles xs (y # ys)) = card (shuffles xs (y # ys))
[PROOF STEP]
by (rule card_image) auto
[PROOF STATE]
proof (state)
this:
card ((#) x ` shuffles xs (y # ys)) = card (shuffles xs (y # ys))

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((#) x ` shuffles xs (y # ys)) = card (shuffles xs (y # ys))

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = (length xs + length (y # ys)) choose length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs
[PROOF STEP]
using "3.prems"
[PROOF STATE]
proof (prove)
using this:
set (x # xs) \<inter> set (y # ys) = {}

goal (1 subgoal):
 1. card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs
[PROOF STEP]
by (intro "3.IH") auto
[PROOF STATE]
proof (state)
this:
card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card ((#) y ` shuffles (x # xs) ys) = card (shuffles (x # xs) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((#) y ` shuffles (x # xs) ys) = card (shuffles (x # xs) ys)
[PROOF STEP]
by (rule card_image) auto
[PROOF STATE]
proof (state)
this:
card ((#) y ` shuffles (x # xs) ys) = card (shuffles (x # xs) ys)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((#) y ` shuffles (x # xs) ys) = card (shuffles (x # xs) ys)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = (length (x # xs) + length ys) choose length (x # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs)
[PROOF STEP]
using "3.prems"
[PROOF STATE]
proof (prove)
using this:
set (x # xs) \<inter> set (y # ys) = {}

goal (1 subgoal):
 1. card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs)
[PROOF STEP]
by (intro "3.IH") auto
[PROOF STATE]
proof (state)
this:
card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "length xs + length (y # ys) choose length xs + \<dots> =
               (length (x # xs) + length (y # ys)) choose length (x # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs)) = length (x # xs) + length (y # ys) choose length (x # xs)

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (shuffles xs (y # ys)) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (shuffles (x # xs) ys) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)

goal (1 subgoal):
 1. card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (shuffles (x # xs) (y # ys)) = length (x # xs) + length (y # ys) choose length (x # xs)

goal (2 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (shuffles [] ys) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (shuffles xs []) = length xs + length [] choose length xs
[PROOF STEP]
qed auto


[STATEMENT]
lemma mod_minus: assumes "a - b > 0" and "c - d > 0"
  shows "(a - b + (c - d mod q)) mod q = (a - b + (c - d)) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b + (c - d mod q)) mod q = (a - b + (c - d)) mod q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a - b
0 < c - d

goal (1 subgoal):
 1. (a - b + (c - d mod q)) mod q = (a - b + (c - d)) mod q
[PROOF STEP]
by (metis cong_def minus_mod mod_add_right_eq zero_less_diff)


[STATEMENT]
lemma MinPredicate:
fixes
  P::"nat \<Rightarrow> bool"
assumes
  "\<exists> n . P n"
shows
  "(\<exists> n0 . (P n0) \<and> (\<forall> n' . (P n') \<longrightarrow> (n' \<ge> n0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n0. P n0 \<and> (\<forall>n'. P n' \<longrightarrow> n0 \<le> n')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>n. P n

goal (1 subgoal):
 1. \<exists>n0. P n0 \<and> (\<forall>n'. P n' \<longrightarrow> n0 \<le> n')
[PROOF STEP]
by (metis LeastI2_wellorder Suc_n_not_le_n)


[STATEMENT]
lemma sum_div_reduce:
  fixes d :: nat and f :: "nat \<Rightarrow> complex"
  assumes "d dvd k" "d > 0"
  shows "(\<Sum>n | n \<in> {1..k} \<and> d dvd n. f n) = (\<Sum>c \<in> {1..k div d}. f (c*d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n | n \<in> {1..k} \<and> d dvd n. f n) = (\<Sum>c = 1..k div d. f (c * d))
[PROOF STEP]
by (rule sum.reindex_bij_witness[of _ "\<lambda>k. k * d" "\<lambda>k. k div d"])
     (use assms in \<open>fastforce simp: div_le_mono\<close>)+


[STATEMENT]
lemma  det_dependent_columns:
  assumes d: "vec.dependent (columns (A::real^'n^'n))"
  shows "det A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = 0
[PROOF STEP]
by (metis d det_dependent_rows rows_transpose det_transpose)


[STATEMENT]
lemma all1_vec_scalar_prod:
shows "all1_vec (length xs) \<bullet> (vec_of_list xs) = sum_list xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
have "all1_vec (length xs) \<bullet> (vec_of_list xs) = (\<Sum>i = 0..<dim_vec (vec_of_list xs). vec_of_list xs $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)}
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec_of_list xs). all1_vec (length xs) $ i * vec_of_list xs $ i) = sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)}
[PROOF STEP]
by (metis (no_types, lifting) all1_vec_def mult_cancel_right1 sum.ivl_cong
    vec.abs_eq dim_vec index_vec vec_of_list.abs_eq)
[PROOF STATE]
proof (state)
this:
all1_vec (length xs) \<bullet> vec_of_list xs = sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)}

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
all1_vec (length xs) \<bullet> vec_of_list xs = sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)}

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
have "... = (\<Sum>i = 0..<length xs. xs ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)} = sum ((!) xs) {0..<length xs}
[PROOF STEP]
using vec.abs_eq dim_vec vec_of_list.abs_eq
[PROOF STATE]
proof (prove)
using this:
vec ?xa ?x = Abs_vec (?xa, mk_vec ?xa ?x)
dim_vec (vec ?n ?f) = ?n
vec_of_list ?x = Abs_vec (length ?x, mk_vec (length ?x) ((!) ?x))

goal (1 subgoal):
 1. sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)} = sum ((!) xs) {0..<length xs}
[PROOF STEP]
by (metis sum.ivl_cong index_vec)
[PROOF STATE]
proof (state)
this:
sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)} = sum ((!) xs) {0..<length xs}

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (($) (vec_of_list xs)) {0..<dim_vec (vec_of_list xs)} = sum ((!) xs) {0..<length xs}

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
have "... = sum_list xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((!) xs) {0..<length xs} = sum_list xs
[PROOF STEP]
by (simp add: sum_list_sum_nth)
[PROOF STATE]
proof (state)
this:
sum ((!) xs) {0..<length xs} = sum_list xs

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs

goal (1 subgoal):
 1. all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
all1_vec (length xs) \<bullet> vec_of_list xs = sum_list xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma catalan_eq_I: "real (catalan n) = I n / (2 * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (catalan n) = I n / (2 * pi)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. real (catalan 0) = I 0 / (2 * pi)
 2. \<And>n. real (catalan n) = I n / (2 * pi) \<Longrightarrow> real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. real (catalan 0) = I 0 / (2 * pi)
 2. \<And>n. real (catalan n) = I n / (2 * pi) \<Longrightarrow> real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (catalan 0) = I 0 / (2 * pi)
[PROOF STEP]
using has_integral_I0
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr - (1 / 2) * sqrt (4 - x)) has_integral 2 * pi) {0..4}

goal (1 subgoal):
 1. real (catalan 0) = I 0 / (2 * pi)
[PROOF STEP]
by (simp add: I_def integral_unique)
[PROOF STATE]
proof (state)
this:
real (catalan 0) = I 0 / (2 * pi)

goal (1 subgoal):
 1. \<And>n. real (catalan n) = I n / (2 * pi) \<Longrightarrow> real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. real (catalan n) = I n / (2 * pi) \<Longrightarrow> real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
real (catalan n) = I n / (2 * pi)

goal (1 subgoal):
 1. \<And>n. real (catalan n) = I n / (2 * pi) \<Longrightarrow> real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (catalan (Suc n)) = I (Suc n) / (2 * pi)
[PROOF STEP]
by (simp add: of_nat_catalan_Suc' Suc.IH I_Suc)
[PROOF STATE]
proof (state)
this:
real (catalan (Suc n)) = I (Suc n) / (2 * pi)

goal:
No subgoals!
[PROOF STEP]
qed