[STATEMENT]
lemma apply_cblinfun_code[code]:
  \<comment> \<open>Code equation for applying an operator \<^term>\<open>A\<close> to a subspace.
      Simply by multiplying each generator with \<^term>\<open>A\<close>\<close>
  "A *\<^sub>S SPAN S = (let d = length (canonical_basis :: 'a list) in
         SPAN (map (mult_mat_vec (mat_of_cblinfun A))
               (filter (\<lambda>v. dim_vec v = d) S)))"
  for A::"'a::onb_enum \<Rightarrow>\<^sub>C\<^sub>L'b::onb_enum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
define dA dB S'
    where "dA = length (canonical_basis :: 'a list)"
      and "dB = length (canonical_basis :: 'b list)"
      and "S' = filter (\<lambda>v. dim_vec v = dA) S"
[PROOF STATE]
proof (state)
this:
dA = length canonical_basis
dB = length canonical_basis
S' = filter (\<lambda>v. dim_vec v = dA) S

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
have "cblinfun_image A (SPAN S) = A *\<^sub>S ccspan (set (map basis_enum_of_vec S'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>S SPAN S = A *\<^sub>S ccspan (set (map basis_enum_of_vec S'))
[PROOF STEP]
unfolding SPAN_def dA_def[symmetric] Let_def S'_def filter_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>S ccspan (basis_enum_of_vec ` set (filter (\<lambda>v. dim_vec v = dA) S)) = A *\<^sub>S ccspan (set (map basis_enum_of_vec (filter (\<lambda>v. dim_vec v = dA) S)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A *\<^sub>S SPAN S = A *\<^sub>S ccspan (set (map basis_enum_of_vec S'))

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *\<^sub>S SPAN S = A *\<^sub>S ccspan (set (map basis_enum_of_vec S'))

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
have "\<dots> = ccspan ((\<lambda>x. basis_enum_of_vec
            (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x :: 'a))) ` set S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>S ccspan (set (map basis_enum_of_vec S')) = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S')
[PROOF STEP]
apply (subst cblinfun_apply_ccspan_using_vec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan (basis_enum_of_vec ` set (map ((*\<^sub>v) (mat_of_cblinfun A)) (map vec_of_basis_enum (map basis_enum_of_vec S')))) = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S')
[PROOF STEP]
by (simp add: image_image)
[PROOF STATE]
proof (state)
this:
A *\<^sub>S ccspan (set (map basis_enum_of_vec S')) = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *\<^sub>S ccspan (set (map basis_enum_of_vec S')) = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
have "\<dots> = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S') = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')
[PROOF STEP]
apply (subst image_cong[OF refl])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> set S' \<Longrightarrow> basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x)) = ?g x
 2. ccspan (?g ` set S') = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')
[PROOF STEP]
apply (subst basis_enum_of_vec_inverse)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> set S' \<Longrightarrow> dim_vec x = length canonical_basis
 2. \<And>x. x \<in> set S' \<Longrightarrow> basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x) = ?g2 x x
 3. ccspan ((\<lambda>x. ?g2 x x) ` set S') = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')
[PROOF STEP]
by (auto simp add: S'_def dA_def)
[PROOF STATE]
proof (state)
this:
ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S') = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v vec_of_basis_enum (basis_enum_of_vec x))) ` set S') = ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
have "\<dots> = SPAN (map (mult_mat_vec (mat_of_cblinfun A)) S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S') = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')
[PROOF STEP]
unfolding SPAN_def dB_def[symmetric] Let_def filter_set
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S') = ccspan (basis_enum_of_vec ` set (filter (\<lambda>v. dim_vec v = dB) (map ((*\<^sub>v) (mat_of_cblinfun A)) S')))
[PROOF STEP]
apply (subst filter_True)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>set (map ((*\<^sub>v) (mat_of_cblinfun A)) S'). dim_vec x = dB
 2. ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S') = ccspan (basis_enum_of_vec ` set (map ((*\<^sub>v) (mat_of_cblinfun A)) S'))
[PROOF STEP]
by (simp_all add: dB_def mat_of_cblinfun_def image_image)
[PROOF STATE]
proof (state)
this:
ccspan ((\<lambda>x. basis_enum_of_vec (mat_of_cblinfun A *\<^sub>v x)) ` set S') = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A *\<^sub>S SPAN S = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>S SPAN S = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))
[PROOF STEP]
unfolding dA_def[symmetric] S'_def[symmetric] Let_def
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>S SPAN S = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')

goal (1 subgoal):
 1. A *\<^sub>S SPAN S = SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) S')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A *\<^sub>S SPAN S = (let d = length canonical_basis in SPAN (map ((*\<^sub>v) (mat_of_cblinfun A)) (filter (\<lambda>v. dim_vec v = d) S)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_theta_div_2:
  "cos (\<theta> / 2) = sqrt ((N - M) / N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (\<theta> / 2) = sqrt (real (N - M) / real N)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (\<theta> / 2) = sqrt (real (N - M) / real N)
[PROOF STEP]
have "\<theta> / 2 = arccos (sqrt ((N - M) / N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<theta> / 2 = arccos (sqrt (real (N - M) / real N))
[PROOF STEP]
using \<theta>_def
[PROOF STATE]
proof (prove)
using this:
\<theta> = 2 * arccos (sqrt (real (N - M) / real N))

goal (1 subgoal):
 1. \<theta> / 2 = arccos (sqrt (real (N - M) / real N))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<theta> / 2 = arccos (sqrt (real (N - M) / real N))

goal (1 subgoal):
 1. cos (\<theta> / 2) = sqrt (real (N - M) / real N)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<theta> / 2 = arccos (sqrt (real (N - M) / real N))
[PROOF STEP]
show "cos (\<theta> / 2) = sqrt ((N - M) / N)"
[PROOF STATE]
proof (prove)
using this:
\<theta> / 2 = arccos (sqrt (real (N - M) / real N))

goal (1 subgoal):
 1. cos (\<theta> / 2) = sqrt (real (N - M) / real N)
[PROOF STEP]
by (simp add: cos_arccos_abs)
[PROOF STATE]
proof (state)
this:
cos (\<theta> / 2) = sqrt (real (N - M) / real N)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_Lambert_W_2:
  assumes "(f \<longlongrightarrow> L) F" "L > -exp (-1)"
  shows   "((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
using order_tendstoD(1)[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. - exp (- 1) < f x
(f \<longlongrightarrow> L) F
- exp (- 1) < L

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W (f x)) \<longlongrightarrow> Lambert_W L) F
[PROOF STEP]
by (intro tendsto_Lambert_W_1) (auto elim: eventually_mono)


[STATEMENT]
lemma zmset_of_plus: "zmset_of (M + N) = zmset_of M + zmset_of N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zmset_of (M + N) = zmset_of M + zmset_of N
[PROOF STEP]
by (transfer, auto simp: equiv_zmset_def eq_onp_same_args plus_multiset.abs_eq)+


[STATEMENT]
lemma mult_mat_limit:
  fixes X :: "nat \<Rightarrow> complex mat" and A B :: "complex mat" and m :: nat
  assumes dimB: "B \<in> carrier_mat m m" and limX: "limit_mat X A m"
  shows "limit_mat (\<lambda>k. X k * B) (A * B) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * B) (A * B) m
[PROOF STEP]
unfolding mat_mult_seq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * B) (A * B) m
[PROOF STEP]
using limit_mat_mult limit_mat_const[OF dimB] limX
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>limit_mat ?X ?A ?m; limit_mat ?Y ?B ?m\<rbrakk> \<Longrightarrow> limit_mat (\<lambda>k. ?X k * ?Y k) (?A * ?B) ?m
limit_mat (\<lambda>k. B) B m
limit_mat X A m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * B) (A * B) m
[PROOF STEP]
by auto


[STATEMENT]
lemma submachine_reachable_subset :
  assumes "is_submachine A B"
shows "reachable_states A \<subseteq> reachable_states B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reachable_states A \<subseteq> reachable_states B
[PROOF STEP]
using assms submachine_path_initial[OF assms]
[PROOF STATE]
proof (prove)
using this:
is_submachine A B
path A (FSM.initial A) ?p \<Longrightarrow> path B (FSM.initial B) ?p

goal (1 subgoal):
 1. reachable_states A \<subseteq> reachable_states B
[PROOF STEP]
unfolding is_submachine.simps reachable_states_def
[PROOF STATE]
proof (prove)
using this:
FSM.initial A = FSM.initial B \<and> FSM.transitions A \<subseteq> FSM.transitions B \<and> FSM.inputs A = FSM.inputs B \<and> FSM.outputs A = FSM.outputs B \<and> FSM.states A \<subseteq> FSM.states B
path A (FSM.initial A) ?p \<Longrightarrow> path B (FSM.initial B) ?p

goal (1 subgoal):
 1. {target (FSM.initial A) p |p. path A (FSM.initial A) p} \<subseteq> {target (FSM.initial B) p |p. path B (FSM.initial B) p}
[PROOF STEP]
by force


[STATEMENT]
lemma group_closure_eq:
  "group_closure S = range (times (Gcd S))" for S :: "int set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group_closure S = range ((*) (Gcd S))
[PROOF STEP]
proof (auto intro: Gcd_in_group_closure group_closure_mult_left)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> group_closure S \<Longrightarrow> x \<in> range ((*) (Gcd S))
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> group_closure S \<Longrightarrow> x \<in> range ((*) (Gcd S))
[PROOF STEP]
assume "s \<in> group_closure S"
[PROOF STATE]
proof (state)
this:
s \<in> group_closure S

goal (1 subgoal):
 1. \<And>x. x \<in> group_closure S \<Longrightarrow> x \<in> range ((*) (Gcd S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<in> group_closure S
[PROOF STEP]
show "s \<in> range (times (Gcd S))"
[PROOF STATE]
proof (prove)
using this:
s \<in> group_closure S

goal (1 subgoal):
 1. s \<in> range ((*) (Gcd S))
[PROOF STEP]
proof induction
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. s \<in> insert 0 S \<Longrightarrow> s \<in> range ((*) (Gcd S))
 2. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
case (base s)
[PROOF STATE]
proof (state)
this:
s \<in> insert 0 S

goal (2 subgoals):
 1. \<And>s. s \<in> insert 0 S \<Longrightarrow> s \<in> range ((*) (Gcd S))
 2. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s \<in> insert 0 S
[PROOF STEP]
have "Gcd S dvd s"
[PROOF STATE]
proof (prove)
using this:
s \<in> insert 0 S

goal (1 subgoal):
 1. Gcd S dvd s
[PROOF STEP]
by (auto intro: Gcd_dvd)
[PROOF STATE]
proof (state)
this:
Gcd S dvd s

goal (2 subgoals):
 1. \<And>s. s \<in> insert 0 S \<Longrightarrow> s \<in> range ((*) (Gcd S))
 2. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gcd S dvd s
[PROOF STEP]
obtain t where "s = Gcd S * t"
[PROOF STATE]
proof (prove)
using this:
Gcd S dvd s

goal (1 subgoal):
 1. (\<And>t. s = Gcd S * t \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
s = Gcd S * t

goal (2 subgoals):
 1. \<And>s. s \<in> insert 0 S \<Longrightarrow> s \<in> range ((*) (Gcd S))
 2. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s = Gcd S * t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
s = Gcd S * t

goal (1 subgoal):
 1. s \<in> range ((*) (Gcd S))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<in> range ((*) (Gcd S))

goal (1 subgoal):
 1. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
case (diff s t)
[PROOF STATE]
proof (state)
this:
s \<in> group_closure S
t \<in> group_closure S
s \<in> range ((*) (Gcd S))
t \<in> range ((*) (Gcd S))

goal (1 subgoal):
 1. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
s \<in> group_closure S
t \<in> group_closure S
s \<in> range ((*) (Gcd S))
t \<in> range ((*) (Gcd S))

goal (1 subgoal):
 1. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
have "Gcd S * a - Gcd S * b = Gcd S * (a - b)" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd S * a - Gcd S * b = Gcd S * (a - b)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
Gcd S * ?a - Gcd S * ?b = Gcd S * (?a - ?b)

goal (1 subgoal):
 1. \<And>s t. \<lbrakk>s \<in> group_closure S; s \<in> range ((*) (Gcd S)); t \<in> group_closure S; t \<in> range ((*) (Gcd S))\<rbrakk> \<Longrightarrow> s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
s \<in> group_closure S
t \<in> group_closure S
s \<in> range ((*) (Gcd S))
t \<in> range ((*) (Gcd S))
Gcd S * ?a - Gcd S * ?b = Gcd S * (?a - ?b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
s \<in> group_closure S
t \<in> group_closure S
s \<in> range ((*) (Gcd S))
t \<in> range ((*) (Gcd S))
Gcd S * ?a - Gcd S * ?b = Gcd S * (?a - ?b)

goal (1 subgoal):
 1. s - t \<in> range ((*) (Gcd S))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s - t \<in> range ((*) (Gcd S))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
s \<in> range ((*) (Gcd S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Smith_normal_form_mat_intro:
  assumes "(\<forall>a. a + 1 < min (dim_row A) (dim_col A) \<longrightarrow> A $$ (a,a) dvd A $$ (a+1,a+1))"
    and "isDiagonal_mat A"
  shows "Smith_normal_form_mat A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Smith_normal_form_mat A
[PROOF STEP]
unfolding Smith_normal_form_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a. a + 1 < min (dim_row A) (dim_col A) \<longrightarrow> A $$ (a, a) dvd A $$ (a + 1, a + 1)) \<and> isDiagonal_mat A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>a. a + 1 < min (dim_row A) (dim_col A) \<longrightarrow> A $$ (a, a) dvd A $$ (a + 1, a + 1)
isDiagonal_mat A

goal (1 subgoal):
 1. (\<forall>a. a + 1 < min (dim_row A) (dim_col A) \<longrightarrow> A $$ (a, a) dvd A $$ (a + 1, a + 1)) \<and> isDiagonal_mat A
[PROOF STEP]
by auto


[STATEMENT]
lemma filterlim_tendsto_add_at_top:
  assumes f: "(f \<longlongrightarrow> c) F"
    and g: "LIM x F. g x :> at_top"
  shows "LIM x F. (f x + g x :: real) :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x + g x :> at_top
[PROOF STEP]
unfolding filterlim_at_top_gt[where c=0]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Z>0. \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
fix Z :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
assume "0 < Z"
[PROOF STATE]
proof (state)
this:
0 < Z

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> c) F
[PROOF STEP]
have "eventually (\<lambda>x. c - 1 < f x) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> c) F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. c - 1 < f x
[PROOF STEP]
by (auto dest!: tendstoD[where e=1] elim!: eventually_mono simp: dist_real_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. c - 1 < f x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. c - 1 < f x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
filterlim g at_top F
[PROOF STEP]
have "eventually (\<lambda>x. Z - (c - 1) \<le> g x) F"
[PROOF STATE]
proof (prove)
using this:
filterlim g at_top F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z - (c - 1) \<le> g x
[PROOF STEP]
unfolding filterlim_at_top
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<forall>\<^sub>F x in F. Z \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z - (c - 1) \<le> g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. Z - (c - 1) \<le> g x

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. c - 1 < f x
\<forall>\<^sub>F x in F. Z - (c - 1) \<le> g x
[PROOF STEP]
show "eventually (\<lambda>x. Z \<le> f x + g x) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. c - 1 < f x
\<forall>\<^sub>F x in F. Z - (c - 1) \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. Z \<le> f x + g x
[PROOF STEP]
by eventually_elim simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. Z \<le> f x + g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma separated_in_real_card_bound2:
  fixes A::"real set"
  assumes A: "finite A" "A \<subseteq> {a..b}" "a \<in> A" "b \<in> A" "a < b"
      and B: "\<And>u. u \<in> A - {b} \<Longrightarrow> next_in A u \<ge> u + d" "d > 0"
  shows "card A \<le> nat (floor ((b-a)/d) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A \<le> nat (\<lfloor>(b - a) / d\<rfloor> + 1)
[PROOF STEP]
proof (rule separated_in_real_card_bound[OF \<open>A \<subseteq> {a..b}\<close> \<open>d > 0\<close>])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> x + d \<le> y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> x + d \<le> y
[PROOF STEP]
assume "x \<in> A" "y \<in> A" "y > x"
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A
x < y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> x + d \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
y \<in> A
x < y
[PROOF STEP]
have "x \<in> A - {b}" "x \<in> {a..<b}"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
x < y

goal (1 subgoal):
 1. x \<in> A - {b} &&& x \<in> {a..<b}
[PROOF STEP]
using \<open>A \<subseteq> {a..b}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
x < y
A \<subseteq> {a..b}

goal (1 subgoal):
 1. x \<in> A - {b} &&& x \<in> {a..<b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> A - {b}
x \<in> {a..<b}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> x + d \<le> y
[PROOF STEP]
have "y \<ge> next_in A x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. next_in A x \<le> y
[PROOF STEP]
using next_in_basics[OF A \<open>x \<in> {a..<b}\<close>] \<open>y \<in> A\<close> \<open>y > x\<close>
[PROOF STATE]
proof (prove)
using this:
next_in A x \<in> A
x < next_in A x
A \<inter> {x<..<next_in A x} = {}
y \<in> A
x < y

goal (1 subgoal):
 1. next_in A x \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
next_in A x \<le> y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> x + d \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
next_in A x \<le> y
[PROOF STEP]
show "y \<ge> x + d"
[PROOF STATE]
proof (prove)
using this:
next_in A x \<le> y

goal (1 subgoal):
 1. x + d \<le> y
[PROOF STEP]
using B(1)[OF \<open>x \<in> A - {b}\<close>]
[PROOF STATE]
proof (prove)
using this:
next_in A x \<le> y
x + d \<le> next_in A x

goal (1 subgoal):
 1. x + d \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x + d \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Suc_times_binomial_eq: "Suc n * (n choose k) = (Suc n choose Suc k) * Suc k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k
[PROOF STEP]
proof (induction n arbitrary: k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k. Suc 0 * (0 choose k) = (Suc 0 choose Suc k) * Suc k
 2. \<And>n k. (\<And>k. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k) \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>k. Suc 0 * (0 choose k) = (Suc 0 choose Suc k) * Suc k
 2. \<And>n k. (\<And>k. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k) \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 * (0 choose k) = (Suc 0 choose Suc k) * Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc 0 * (0 choose k) = (Suc 0 choose Suc k) * Suc k

goal (1 subgoal):
 1. \<And>n k. (\<And>k. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k) \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. (\<And>k. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k) \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
Suc n * (n choose ?k) = (Suc n choose Suc ?k) * Suc ?k

goal (1 subgoal):
 1. \<And>n k. (\<And>k. Suc n * (n choose k) = (Suc n choose Suc k) * Suc k) \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
 2. \<And>nat. k = Suc nat \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
case (Suc k')
[PROOF STATE]
proof (state)
this:
k = Suc k'

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
 2. \<And>nat. k = Suc nat \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = Suc k'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = Suc k'

goal (1 subgoal):
 1. Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
k = Suc k'
Suc n * (n choose ?k) = (Suc n choose Suc ?k) * Suc ?k

goal (1 subgoal):
 1. Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
by (auto simp add: add_mult_distrib add_mult_distrib2 le_Suc_eq binomial_eq_0)
[PROOF STATE]
proof (state)
this:
Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k

goal (1 subgoal):
 1. k = 0 \<Longrightarrow> Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
Suc (Suc n) * (Suc n choose k) = (Suc (Suc n) choose Suc k) * Suc k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma left_inv_of_unitary_transpose [simp]:
  assumes "unitary U"
  shows "(U\<^sup>t)\<^sup>\<dagger> * (U\<^sup>t) =  1\<^sub>m(dim_row U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
have "dim_col U = dim_row ((U\<^sup>t)\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col U = dim_row U\<^sup>t\<^sup>\<star>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col U = dim_row U\<^sup>t\<^sup>\<star>

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_col U = dim_row U\<^sup>t\<^sup>\<star>
[PROOF STEP]
have "(U * ((U\<^sup>t)\<^sup>\<star>))\<^sup>\<star> = (U\<^sup>\<star>) * (U\<^sup>t)"
[PROOF STATE]
proof (prove)
using this:
dim_col U = dim_row U\<^sup>t\<^sup>\<star>

goal (1 subgoal):
 1. U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>\<star> * U\<^sup>t
[PROOF STEP]
using cpx_mat_cnj_prod cpx_mat_cnj_cnj
[PROOF STATE]
proof (prove)
using this:
dim_col U = dim_row U\<^sup>t\<^sup>\<star>
dim_col ?M = dim_row ?N \<Longrightarrow> ?M * ?N\<^sup>\<star> = ?M\<^sup>\<star> * ?N\<^sup>\<star>
?M\<^sup>\<star>\<^sup>\<star> = ?M

goal (1 subgoal):
 1. U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>\<star> * U\<^sup>t
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>\<star> * U\<^sup>t

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>\<star> * U\<^sup>t

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
have "\<dots> = (U\<^sup>t)\<^sup>\<dagger> * (U\<^sup>t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U\<^sup>\<star> * U\<^sup>t = U\<^sup>t\<^sup>\<dagger> * U\<^sup>t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
U\<^sup>\<star> * U\<^sup>t = U\<^sup>t\<^sup>\<dagger> * U\<^sup>t

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>t\<^sup>\<dagger> * U\<^sup>t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>t\<^sup>\<dagger> * U\<^sup>t

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
U * U\<^sup>t\<^sup>\<star>\<^sup>\<star> = U\<^sup>t\<^sup>\<dagger> * U\<^sup>t
unitary U

goal (1 subgoal):
 1. U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)
[PROOF STEP]
by (metis transpose_cnj_is_dagger cpx_mat_cnj_id unitary_def)
[PROOF STATE]
proof (state)
this:
U\<^sup>t\<^sup>\<dagger> * U\<^sup>t = 1\<^sub>m (dim_row U)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_with_itself_eq0 [simp]:
  assumes "u = 0\<^sub>v (dim_vec u)"
  shows "\<langle>u|u\<rangle> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>u|u\<rangle> = 0
[PROOF STEP]
using assms inner_prod_def zero_vec_def
[PROOF STATE]
proof (prove)
using this:
u = 0\<^sub>v (dim_vec u)
\<langle>?u|?v\<rangle> \<equiv> \<Sum>i = 0..<dim_vec ?v. cnj (?u $ i) * ?v $ i
0\<^sub>v ?n \<equiv> vec ?n (\<lambda>i. 0::?'a)

goal (1 subgoal):
 1. \<langle>u|u\<rangle> = 0
[PROOF STEP]
by (smt atLeastLessThan_iff complex_cnj_zero index_zero_vec(1) mult_zero_left sum.neutral)


[STATEMENT]
lemma prime_gt_1_int: "prime p \<Longrightarrow> p > (1::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 < p
[PROOF STEP]
using prime_ge_2_int [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 2 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 < p
[PROOF STEP]
by simp


[STATEMENT]
lemma normalize_square:
  "(normalize p $ 1)\<^sup>2 + (normalize p $ 2)\<^sup>2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (normalize p $ 1)\<^sup>2 + (normalize p $ 2)\<^sup>2 = 1
[PROOF STEP]
using dot_square_norm[of "normalize p"]
[PROOF STATE]
proof (prove)
using this:
normalize p \<bullet> normalize p = (norm (normalize p))\<^sup>2

goal (1 subgoal):
 1. (normalize p $ 1)\<^sup>2 + (normalize p $ 2)\<^sup>2 = 1
[PROOF STEP]
by (simp add: inner_vec_def UNIV_2 power2_eq_square norm_normalize)


[STATEMENT]
lemma diagonal_mat_uminus:
  fixes A::"'a::{ring} Matrix.mat"
  assumes "diagonal_mat A"
  shows "diagonal_mat (-A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat (- A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat A

goal (1 subgoal):
 1. diagonal_mat (- A)
[PROOF STEP]
unfolding diagonal_mat_def uminus_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i<dim_row A. \<forall>j<dim_col A. i \<noteq> j \<longrightarrow> A $$ (i, j) = (0::'a)

goal (1 subgoal):
 1. \<forall>i<dim_row (Matrix.mat (dim_row A) (dim_col A) (\<lambda>ij. - A $$ ij)). \<forall>j<dim_col (Matrix.mat (dim_row A) (dim_col A) (\<lambda>ij. - A $$ ij)). i \<noteq> j \<longrightarrow> Matrix.mat (dim_row A) (dim_col A) (\<lambda>ij. - A $$ ij) $$ (i, j) = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ring) add_pow_ldistr_int: \<^marker>\<open>contributor \<open>Paulo Em?lio de Vilhena\<close>\<close>
  assumes "a \<in> carrier R" "b \<in> carrier R"
  shows "([(k :: int)] \<cdot> a) \<otimes> b = [k] \<cdot> (a \<otimes> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
proof (cases "k \<ge> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
 2. \<not> 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> k

goal (2 subgoals):
 1. 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
 2. \<not> 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> k

goal (1 subgoal):
 1. [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
using add_pow_int_ge[of k R] add_pow_ldistr[OF assms]
[PROOF STATE]
proof (prove)
using this:
0 \<le> k
0 \<le> k \<Longrightarrow> [k] \<cdot> ?a = [nat k] \<cdot> ?a
[?k] \<cdot> a \<otimes> b = [?k] \<cdot> (a \<otimes> b)

goal (1 subgoal):
 1. [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)

goal (1 subgoal):
 1. \<not> 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> k

goal (1 subgoal):
 1. \<not> 0 \<le> k \<Longrightarrow> [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> k

goal (1 subgoal):
 1. [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
using add_pow_int_lt[of k R a] add_pow_int_lt[of k R "a \<otimes> b"]
          add_pow_ldistr[OF assms, of "nat (- k)"] assms l_minus
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> k
k < 0 \<Longrightarrow> [k] \<cdot> a = \<ominus> ([nat (- k)] \<cdot> a)
k < 0 \<Longrightarrow> [k] \<cdot> (a \<otimes> b) = \<ominus> ([nat (- k)] \<cdot> (a \<otimes> b))
[nat (- k)] \<cdot> a \<otimes> b = [nat (- k)] \<cdot> (a \<otimes> b)
a \<in> carrier R
b \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> \<ominus> ?x \<otimes> ?y = \<ominus> (?x \<otimes> ?y)

goal (1 subgoal):
 1. [k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[k] \<cdot> a \<otimes> b = [k] \<cdot> (a \<otimes> b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldr_zero: "\<forall> i < length xs. xs !  i > 0 \<Longrightarrow>
        foldr (\<lambda> a b. a+b) xs (d::nat) - d  \<ge> length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d
[PROOF STEP]
proof(induction xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<length []. 0 < [] ! i \<Longrightarrow> length [] \<le> foldr (+) [] d - d
 2. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
\<forall>i<length []. 0 < [] ! i

goal (2 subgoals):
 1. \<forall>i<length []. 0 < [] ! i \<Longrightarrow> length [] \<le> foldr (+) [] d - d
 2. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i<length []. 0 < [] ! i
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length []. 0 < [] ! i

goal (1 subgoal):
 1. length [] \<le> foldr (+) [] d - d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length [] \<le> foldr (+) [] d - d

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d
\<forall>i<length (a # xs). 0 < (a # xs) ! i

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
hence "\<forall>i<length xs. 0 < xs ! i"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d
\<forall>i<length (a # xs). 0 < (a # xs) ! i

goal (1 subgoal):
 1. \<forall>i<length xs. 0 < xs ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<length xs. 0 < xs ! i

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
hence " length xs \<le> foldr (+) xs d - d"
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. 0 < xs ! i

goal (1 subgoal):
 1. length xs \<le> foldr (+) xs d - d
[PROOF STEP]
using Cons.IH
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. 0 < xs ! i
\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d

goal (1 subgoal):
 1. length xs \<le> foldr (+) xs d - d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs \<le> foldr (+) xs d - d

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
have "a \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> a
[PROOF STEP]
by (metis gr0_conv_Suc length_Cons less_one local.Cons(2) not_gr0 not_less nth_Cons_0)
[PROOF STATE]
proof (state)
this:
1 \<le> a

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>i<length xs. 0 < xs ! i \<Longrightarrow> length xs \<le> foldr (+) xs d - d; \<forall>i<length (a # xs). 0 < (a # xs) ! i\<rbrakk> \<Longrightarrow> length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 \<le> a

goal (1 subgoal):
 1. length (a # xs) \<le> foldr (+) (a # xs) d - d
[PROOF STEP]
by (metis Nat.add_diff_assoc \<open>length xs \<le> foldr (+) xs d - d\<close> add_mono_thms_linordered_semiring(1) foldr.simps(2) foldr_one length_Cons o_apply plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
length (a # xs) \<le> foldr (+) (a # xs) d - d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Jacobi_mult_left [simp]: "Jacobi (a * b) n = Jacobi a n * Jacobi b n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
 2. n \<noteq> 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
 2. n \<noteq> 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
have *: "{# Legendre (a * b) p          . p \<in># prime_factorization n #} =
           {# Legendre a p * Legendre b p . p \<in># prime_factorization n #}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset (Legendre (a * b)) (prime_factorization n) = {#Legendre a p * Legendre b p. p \<in># prime_factorization n#}
[PROOF STEP]
by (meson Legendre_mult in_prime_factors_imp_prime image_mset_cong)
[PROOF STATE]
proof (state)
this:
image_mset (Legendre (a * b)) (prime_factorization n) = {#Legendre a p * Legendre b p. p \<in># prime_factorization n#}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
 2. n \<noteq> 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
unfolding Jacobi_def * prod_mset.distrib
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (if n = 0 then 0 else \<Prod>\<^sub># (image_mset (Legendre a) (prime_factorization n)) * \<Prod>\<^sub># (image_mset (Legendre b) (prime_factorization n))) = (if n = 0 then 0 else \<Prod>\<^sub># (image_mset (Legendre a) (prime_factorization n))) * (if n = 0 then 0 else \<Prod>\<^sub># (image_mset (Legendre b) (prime_factorization n)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Jacobi (a * b) n = Jacobi a n * Jacobi b n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> Jacobi (a * b) n = Jacobi a n * Jacobi b n
[PROOF STEP]
qed auto


[STATEMENT]
lemma sums_confine:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
  shows "confine f N sums l \<longleftrightarrow> ((\<lambda>n. \<Sum>i \<in> {..<n} \<inter> N. f i) \<longlonglongrightarrow> l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confine f N sums l = (\<lambda>n. sum f ({..<n} \<inter> N)) \<longlonglongrightarrow> l
[PROOF STEP]
by (simp add: sums_def atLeast0LessThan confine_def sum.inter_restrict)


[STATEMENT]
lemma iT_Plus_card: "card (I \<oplus> k) = card I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (I \<oplus> k) = card I
[PROOF STEP]
apply (unfold iT_Plus_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>n. n + k) ` I) = card I
[PROOF STEP]
apply (rule card_image)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>n. n + k) I
[PROOF STEP]
apply (rule inj_imp_inj_on)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>n. n + k)
[PROOF STEP]
apply (rule add_right_inj)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nn_integral_count_compose_bij:
  assumes "bij_betw g A B"
  shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> B. f y \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
have "inj_on g A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on g A
[PROOF STEP]
using assms bij_betw_def
[PROOF STATE]
proof (prove)
using this:
bij_betw g A B
bij_betw ?f ?A ?B = (inj_on ?f ?A \<and> ?f ` ?A = ?B)

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

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on g A
[PROOF STEP]
have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
using this:
inj_on g A

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
by (rule nn_integral_count_compose_inj)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) (g ` A) f
bij_betw g A B

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f
[PROOF STEP]
by (simp add: bij_betw_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. f (g x)\<partial>count_space UNIV = set_nn_integral (count_space UNIV) B f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_nth_eucl: "norm x = L2_set (\<lambda>i. x $\<^sub>e i) {..<DIM('a)}"
  for x::"'a::executable_euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x = L2_set (($\<^sub>e) x) {..<DIM('a)}
[PROOF STEP]
unfolding norm_eq_sqrt_inner inner_nth_eucl L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i<DIM('a). x $\<^sub>e i * x $\<^sub>e i) = sqrt (\<Sum>i<DIM('a). (x $\<^sub>e i)\<^sup>2)
[PROOF STEP]
by (auto simp: power2_eq_square)


[STATEMENT]
lemma INF_ennreal_add_const:
  fixes f g :: "nat \<Rightarrow> ennreal"
  shows "(INF i. f i + c) = (INF i. f i) + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i. f i + c) = Inf (range f) + c
[PROOF STEP]
using continuous_at_Inf_mono[of "\<lambda>x. x + c" "f`UNIV"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mono (\<lambda>x. x + c); continuous (at_right (Inf (range f))) (\<lambda>x. x + c); range f \<noteq> {}; bdd_below (range f)\<rbrakk> \<Longrightarrow> Inf (range f) + c = (INF s\<in>range f. s + c)

goal (1 subgoal):
 1. (INF i. f i + c) = Inf (range f) + c
[PROOF STEP]
using continuous_add[of "at_right (Inf (range f))", of "\<lambda>x. x" "\<lambda>x. c"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mono (\<lambda>x. x + c); continuous (at_right (Inf (range f))) (\<lambda>x. x + c); range f \<noteq> {}; bdd_below (range f)\<rbrakk> \<Longrightarrow> Inf (range f) + c = (INF s\<in>range f. s + c)
\<lbrakk>continuous (at_right (Inf (range f))) (\<lambda>x. x); continuous (at_right (Inf (range f))) (\<lambda>x. c)\<rbrakk> \<Longrightarrow> continuous (at_right (Inf (range f))) (\<lambda>x. x + c)

goal (1 subgoal):
 1. (INF i. f i + c) = Inf (range f) + c
[PROOF STEP]
by (auto simp: mono_def image_comp)


[STATEMENT]
lemma wf_sorted_list:
  "wf ((\<lambda>(x,y). (sorted_list_of_set x, sorted_list_of_set y)) ` finite_psubset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf ((\<lambda>(x, y). (sorted_list_of_set x, sorted_list_of_set y)) ` finite_psubset)
[PROOF STEP]
apply (unfold finite_psubset_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf ((\<lambda>(x, y). (sorted_list_of_set x, sorted_list_of_set y)) ` {(A, B). A \<subset> B \<and> finite B})
[PROOF STEP]
apply (rule wf_measure [THEN wf_subset])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (sorted_list_of_set x, sorted_list_of_set y)) ` {(A, B). A \<subset> B \<and> finite B} \<subseteq> measure ?f1
[PROOF STEP]
apply (simp add: measure_def inv_image_def image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>a b. a \<subset> b \<and> finite b \<and> y = (sorted_list_of_set a, sorted_list_of_set b)} \<subseteq> {(x, y). ?f1 x < ?f1 y}
[PROOF STEP]
by (auto intro: sorted_list_len_lt)


[STATEMENT]
lemma mset_union_size_inter: "size (A \<union># B) = size (A) + size B - size (A \<inter># B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (A \<union># B) = size A + size B - size (A \<inter># B)
[PROOF STEP]
by (metis diff_add_inverse2 size_Un_Int)


[STATEMENT]
lemma nat_mod:
 assumes  "(m::nat) > n"
 shows "(m::nat) mod n = (m -n) mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m mod n = (m - n) mod n
[PROOF STEP]
using assms mod_if not_less_iff_gr_or_eq
[PROOF STATE]
proof (prove)
using this:
n < m
?m mod ?n = (if ?m < ?n then ?m else (?m - ?n) mod ?n)
(\<not> ?x < ?y) = (?y < ?x \<or> ?x = ?y)

goal (1 subgoal):
 1. m mod n = (m - n) mod n
[PROOF STEP]
by auto


[STATEMENT]
lemma image_Nset_Suc:"f ` ({j. j \<le> (Suc n)}) =
                             insert (f (Suc n)) (f ` {j. j \<le> n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})
[PROOF STEP]
apply (cut_tac Nset_un[of "n"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {j. j \<le> Suc n} = {j. j \<le> n} \<union> {Suc n} \<Longrightarrow> f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})
[PROOF STEP]
apply (frule im_set_un2[of "{j. j \<le> (Suc n)}" "{j. j \<le> n}" "{Suc n}" "f"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>{j. j \<le> Suc n} = {j. j \<le> n} \<union> {Suc n}; f ` {j. j \<le> Suc n} = f ` {j. j \<le> n} \<union> f ` {Suc n}\<rbrakk> \<Longrightarrow> f ` {j. j \<le> Suc n} = insert (f (Suc n)) (f ` {j. j \<le> n})
[PROOF STEP]
apply (simp add:Un_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma product_topology_basis:
  assumes "\<And>i. openin (T i) (X i)" "finite {i. X i \<noteq> topspace (T i)}"
  shows "openin (product_topology T I) (\<Pi>\<^sub>E i\<in>I. X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (product_topology T I) (Pi\<^sub>E I X)
[PROOF STEP]
unfolding product_topology_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (topology_generated_by {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}) (Pi\<^sub>E I X)
[PROOF STEP]
by (rule topology_generated_by_Basis) (use assms in auto)


[STATEMENT]
lemma cis_eq:
  assumes "cis a = cis b"
  shows "\<exists> k::int. a - b = 2 * k * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. a - b = 2 * real_of_int x * pi
[PROOF STEP]
using assms sin_cos_eq[of a b]
[PROOF STATE]
proof (prove)
using this:
cis a = cis b
\<lbrakk>cos a = cos b; sin a = sin b\<rbrakk> \<Longrightarrow> \<exists>x. a - b = 2 * real_of_int x * pi

goal (1 subgoal):
 1. \<exists>x. a - b = 2 * real_of_int x * pi
[PROOF STEP]
using cis.sel[of a] cis.sel[of b]
[PROOF STATE]
proof (prove)
using this:
cis a = cis b
\<lbrakk>cos a = cos b; sin a = sin b\<rbrakk> \<Longrightarrow> \<exists>x. a - b = 2 * real_of_int x * pi
Re (cis a) = cos a
Im (cis a) = sin a
Re (cis b) = cos b
Im (cis b) = sin b

goal (1 subgoal):
 1. \<exists>x. a - b = 2 * real_of_int x * pi
[PROOF STEP]
by (cases "cis a", cases "cis b") auto


[STATEMENT]
lemma ex_k_mod:
  assumes coprime: "coprime (e :: nat) ((P-1)*(Q-1))"
    and "P \<noteq> Q"
    and "prime P"
    and "prime Q"
    and "d \<noteq> 0"
    and " [e*d = 1] (mod (P-1))"
  shows "\<exists> k. e*d = 1 + k*(P-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
have "e > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
using assms(1) assms(2) prime_gt_0_nat
[PROOF STATE]
proof (prove)
using this:
coprime e ((P - 1) * (Q - 1))
P \<noteq> Q
prime ?p \<Longrightarrow> 0 < ?p

goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have "e*d \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 1 \<le> e * d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < e
coprime e ((P - 1) * (Q - 1))
P \<noteq> Q
prime P
prime Q
d \<noteq> 0
[e * d = 1] (mod P - 1)

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

goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> e * d
[PROOF STEP]
obtain k where k: "e*d = 1 + k*(P-1)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> e * d

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(6) cong_to_1'_nat
[PROOF STATE]
proof (prove)
using this:
1 \<le> e * d
[e * d = 1] (mod P - 1)
[?a = 1] (mod ?n) = (?a = 0 \<and> ?n = 1 \<or> (\<exists>m. ?a = 1 + m * ?n))

goal (1 subgoal):
 1. (\<And>k. e * d = 1 + k * (P - 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e * d = 1 + k * (P - 1)

goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e * d = 1 + k * (P - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e * d = 1 + k * (P - 1)

goal (1 subgoal):
 1. \<exists>k. e * d = 1 + k * (P - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>k. e * d = 1 + k * (P - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ltake_llist_of [simp]:
  "ltake (enat n) (llist_of xs) = llist_of (take n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat n) (llist_of xs) = llist_of (take n xs)
[PROOF STEP]
proof(induct n arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. ltake (enat 0) (llist_of xs) = llist_of (take 0 xs)
 2. \<And>n xs. (\<And>xs. ltake (enat n) (llist_of xs) = llist_of (take n xs)) \<Longrightarrow> ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>xs. ltake (enat 0) (llist_of xs) = llist_of (take 0 xs)
 2. \<And>n xs. (\<And>xs. ltake (enat n) (llist_of xs) = llist_of (take n xs)) \<Longrightarrow> ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake (enat 0) (llist_of xs) = llist_of (take 0 xs)
[PROOF STEP]
unfolding zero_enat_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake 0 (llist_of xs) = llist_of (take 0 xs)
[PROOF STEP]
by(cases xs) simp_all
[PROOF STATE]
proof (state)
this:
ltake (enat 0) (llist_of xs) = llist_of (take 0 xs)

goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltake (enat n) (llist_of xs) = llist_of (take n xs)) \<Longrightarrow> ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltake (enat n) (llist_of xs) = llist_of (take n xs)) \<Longrightarrow> ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ltake (enat n) (llist_of ?xs) = llist_of (take n ?xs)

goal (1 subgoal):
 1. \<And>n xs. (\<And>xs. ltake (enat n) (llist_of xs) = llist_of (take n xs)) \<Longrightarrow> ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ltake (enat n) (llist_of ?xs) = llist_of (take n ?xs)

goal (1 subgoal):
 1. ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
unfolding eSuc_enat[symmetric]
[PROOF STATE]
proof (prove)
using this:
ltake (enat n) (llist_of ?xs) = llist_of (take n ?xs)

goal (1 subgoal):
 1. ltake (eSuc (enat n)) (llist_of xs) = llist_of (take (Suc n) xs)
[PROOF STEP]
by(cases xs) simp_all
[PROOF STATE]
proof (state)
this:
ltake (enat (Suc n)) (llist_of xs) = llist_of (take (Suc n) xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma onorm_triangle_lt:
  assumes "bounded_linear f"
  assumes "bounded_linear g"
  assumes "onorm f + onorm g < e"
  shows "onorm (\<lambda>x. f x + g x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. f x + g x) < e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_linear f
bounded_linear g
onorm f + onorm g < e

goal (1 subgoal):
 1. onorm (\<lambda>x. f x + g x) < e
[PROOF STEP]
by (rule onorm_triangle [THEN order_le_less_trans])


[STATEMENT]
lemma ord_ordered:
  assumes abc: "ord a b c"
      and abc_neq: "a \<noteq> b \<and> a \<noteq> c \<and> b \<noteq> c"
  shows "\<exists>f. ordering f ord {a,b,c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. TernaryOrdering.ordering f ord {a, b, c}
[PROOF STEP]
apply (rule_tac x = "\<lambda>n. if n = 0 then a else if n = 1 then b else c" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TernaryOrdering.ordering (\<lambda>n. if n = 0 then a else if n = 1 then b else c) ord {a, b, c}
[PROOF STEP]
apply (unfold ordering_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. (finite {a, b, c} \<longrightarrow> n < card {a, b, c}) \<longrightarrow> (if n = 0 then a else if n = 1 then b else c) \<in> {a, b, c}) \<and> (\<forall>x\<in>{a, b, c}. \<exists>n. (finite {a, b, c} \<longrightarrow> n < card {a, b, c}) \<and> (if n = 0 then a else if n = 1 then b else c) = x) \<and> (\<forall>n n' n''. (finite {a, b, c} \<longrightarrow> n'' < card {a, b, c}) \<and> n < n' \<and> n' < n'' \<longrightarrow> ord (if n = 0 then a else if n = 1 then b else c) (if n' = 0 then a else if n' = 1 then b else c) (if n'' = 0 then a else if n'' = 1 then b else c))
[PROOF STEP]
using abc abc_neq
[PROOF STATE]
proof (prove)
using this:
ord a b c
a \<noteq> b \<and> a \<noteq> c \<and> b \<noteq> c

goal (1 subgoal):
 1. (\<forall>n. (finite {a, b, c} \<longrightarrow> n < card {a, b, c}) \<longrightarrow> (if n = 0 then a else if n = 1 then b else c) \<in> {a, b, c}) \<and> (\<forall>x\<in>{a, b, c}. \<exists>n. (finite {a, b, c} \<longrightarrow> n < card {a, b, c}) \<and> (if n = 0 then a else if n = 1 then b else c) = x) \<and> (\<forall>n n' n''. (finite {a, b, c} \<longrightarrow> n'' < card {a, b, c}) \<and> n < n' \<and> n' < n'' \<longrightarrow> ord (if n = 0 then a else if n = 1 then b else c) (if n' = 0 then a else if n' = 1 then b else c) (if n'' = 0 then a else if n'' = 1 then b else c))
[PROOF STEP]
by auto


[STATEMENT]
lemma le_nrows: "(n <= nrows A) = (\<forall> m. (\<forall> j i. m <= j \<longrightarrow> (Rep_matrix A j i) = 0) \<longrightarrow> n <= m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n \<le> nrows A) = (\<forall>m. (\<forall>j i. m \<le> j \<longrightarrow> Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> m)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>n \<le> nrows A; \<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)\<rbrakk> \<Longrightarrow> n \<le> m
 2. \<forall>m. (\<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> m \<Longrightarrow> n \<le> nrows A
[PROOF STEP]
apply (subgoal_tac "nrows A <= m")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>m. \<lbrakk>n \<le> nrows A; \<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a); nrows A \<le> m\<rbrakk> \<Longrightarrow> n \<le> m
 2. \<And>m. \<lbrakk>n \<le> nrows A; \<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)\<rbrakk> \<Longrightarrow> nrows A \<le> m
 3. \<forall>m. (\<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> m \<Longrightarrow> n \<le> nrows A
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. \<lbrakk>n \<le> nrows A; \<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)\<rbrakk> \<Longrightarrow> nrows A \<le> m
 2. \<forall>m. (\<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> m \<Longrightarrow> n \<le> nrows A
[PROOF STEP]
apply (simp add: nrows_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m. (\<forall>j\<ge>m. \<forall>i. Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> m \<Longrightarrow> n \<le> nrows A
[PROOF STEP]
apply (drule_tac x="nrows A" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<ge>nrows A. \<forall>i. Rep_matrix A j i = (0::'a)) \<longrightarrow> n \<le> nrows A \<Longrightarrow> n \<le> nrows A
[PROOF STEP]
by (simp add: nrows)


[STATEMENT]
lemma fset_size_le:
  assumes "x \<in> fset xs"
  shows "size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
have "size x \<le> (\<Sum>x\<in>fset xs. size x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size x \<le> sum size (fset xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> fset xs

goal (1 subgoal):
 1. size x \<le> sum size (fset xs)
[PROOF STEP]
by (auto intro: member_le_sum)
[PROOF STATE]
proof (state)
this:
size x \<le> sum size (fset xs)

goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
size x \<le> sum size (fset xs)

goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
have "(\<Sum>x\<in>fset xs. size x) < (\<Sum>x\<in>fset xs. Suc (size x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum size (fset xs) < (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
by (metis assms empty_iff finite_fset lessI sum_strict_mono)
[PROOF STATE]
proof (state)
this:
sum size (fset xs) < (\<Sum>x\<in>fset xs. Suc (size x))

goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
size x \<le> sum size (fset xs)
sum size (fset xs) < (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size x \<le> sum size (fset xs)
sum size (fset xs) < (\<Sum>x\<in>fset xs. Suc (size x))

goal (1 subgoal):
 1. size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size x < Suc (\<Sum>x\<in>fset xs. Suc (size x))

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
lemma DERIV_real_root_generic:
  assumes "0 < n"
    and "x \<noteq> 0"
    and "even n \<Longrightarrow> 0 < x \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"
    and "even n \<Longrightarrow> x < 0 \<Longrightarrow> D = - inverse (real n * root n x ^ (n - Suc 0))"
    and "odd n \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))"
  shows "DERIV (root n) x :> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (root n has_real_derivative D) (at x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
x \<noteq> 0
\<lbrakk>even n; 0 < x\<rbrakk> \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))
\<lbrakk>even n; x < 0\<rbrakk> \<Longrightarrow> D = - inverse (real n * root n x ^ (n - Suc 0))
odd n \<Longrightarrow> D = inverse (real n * root n x ^ (n - Suc 0))

goal (1 subgoal):
 1. (root n has_real_derivative D) (at x)
[PROOF STEP]
by (cases "even n", cases "0 < x")
    (auto intro: DERIV_real_root[THEN DERIV_cong]
      DERIV_odd_real_root[THEN DERIV_cong]
      DERIV_even_real_root[THEN DERIV_cong])


[STATEMENT]
lemma singleton_subset_singleton_conv: "({a} \<subseteq> {b}) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({a} \<subseteq> {b}) = (a = b)
[PROOF STEP]
by blast


[STATEMENT]
lemma bernoulli_upto_20 [simp]:
  "bernoulli 2 = 1 / 6"
  "bernoulli 4 = -(1 / 30)"
  "bernoulli 6 = 1 / 42"
  "bernoulli 8 = - (1 / 30)"
  "bernoulli 10 = 5 / 66"
  "bernoulli 12 = - (691 / 2730)"
  "bernoulli 14 = 7 / 6"
  "bernoulli 16 = -(3617 / 510)"
  "bernoulli 18 = 43867 / 798"
  "bernoulli 20 = -(174611 / 330)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((bernoulli 2 = 1 / 6 &&& bernoulli 4 = - (1 / 30)) &&& bernoulli 6 = 1 / 42 &&& bernoulli 8 = - (1 / 30) &&& bernoulli 10 = 5 / 66) &&& (bernoulli 12 = - (691 / 2730) &&& bernoulli 14 = 7 / 6) &&& bernoulli 16 = - (3617 / 510) &&& bernoulli 18 = 43867 / 798 &&& bernoulli 20 = - (174611 / 330)
[PROOF STEP]
by (simp_all add: eval_bernoulli)


[STATEMENT]
lemma alg_closed_imp_poly_has_root:
  assumes "degree (p :: 'a :: alg_closed_field poly) > 0"
  shows   "\<exists>x. poly p x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a)
[PROOF STEP]
have "\<exists>x. (\<Sum>k\<le>degree p. coeff p k * x ^ k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (\<Sum>k\<le>degree p. coeff p k * x ^ k) = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < degree p

goal (1 subgoal):
 1. \<exists>x. (\<Sum>k\<le>degree p. coeff p k * x ^ k) = (0::'a)
[PROOF STEP]
by (intro alg_closed) auto
[PROOF STATE]
proof (state)
this:
\<exists>x. (\<Sum>k\<le>degree p. coeff p k * x ^ k) = (0::'a)

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>x. (\<Sum>k\<le>degree p. coeff p k * x ^ k) = (0::'a)

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a)
[PROOF STEP]
by (simp add: poly_altdef)
[PROOF STATE]
proof (state)
this:
\<exists>x. poly p x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summableI_nonneg_bounded:
  fixes f :: "nat \<Rightarrow> 'a::{ordered_comm_monoid_add,linorder_topology,conditionally_complete_linorder}"
  assumes pos[simp]: "\<And>n. 0 \<le> f n"
    and le: "\<And>n. (\<Sum>i<n. f i) \<le> x"
  shows "summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f
[PROOF STEP]
unfolding summable_def sums_def [abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> s
[PROOF STEP]
proof (rule exI LIMSEQ_incseq_SUP)+
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bdd_above (range (\<lambda>n. sum f {..<n}))
 2. incseq (\<lambda>n. sum f {..<n})
[PROOF STEP]
show "bdd_above (range (\<lambda>n. sum f {..<n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. sum f {..<n}))
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
sum f {..<?n} \<le> x

goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. sum f {..<n}))
[PROOF STEP]
by (auto simp: bdd_above_def)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. sum f {..<n}))

goal (1 subgoal):
 1. incseq (\<lambda>n. sum f {..<n})
[PROOF STEP]
show "incseq (\<lambda>n. sum f {..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. sum f {..<n})
[PROOF STEP]
by (auto simp: mono_def intro!: sum_mono2)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. sum f {..<n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem nat_to_set_srj: "finite (D::nat set) \<Longrightarrow> nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
assume A: "finite D"
[PROOF STATE]
proof (state)
this:
finite D

goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
let ?P = "\<lambda> (n::nat). (\<forall> (D::nat set). finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
have P_at_0: "?P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof (rule allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
fix D
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
show "finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
assume A1: "finite D \<and> card D = 0"
[PROOF STATE]
proof (state)
this:
finite D \<and> card D = 0

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
finite D \<and> card D = 0
[PROOF STEP]
have S1: "finite D"
[PROOF STATE]
proof (prove)
using this:
finite D \<and> card D = 0

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

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
finite D \<and> card D = 0
[PROOF STEP]
have S2: "card D = 0"
[PROOF STATE]
proof (prove)
using this:
finite D \<and> card D = 0

goal (1 subgoal):
 1. card D = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card D = 0

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
finite D
card D = 0
[PROOF STEP]
have S3: "D = {}"
[PROOF STATE]
proof (prove)
using this:
finite D
card D = 0

goal (1 subgoal):
 1. D = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D = {}

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with set_to_nat_def
[PROOF STATE]
proof (chain)
picking this:
set_to_nat = sum ((^) 2)
D = {}
[PROOF STEP]
have "set_to_nat D = sum (\<lambda> x. 2 ^ x) D"
[PROOF STATE]
proof (prove)
using this:
set_to_nat = sum ((^) 2)
D = {}

goal (1 subgoal):
 1. set_to_nat D = sum ((^) 2) D
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_to_nat D = sum ((^) 2) D

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with S3 sum.empty
[PROOF STATE]
proof (chain)
picking this:
D = {}
sum ?g {} = (0::?'a)
set_to_nat D = sum ((^) 2) D
[PROOF STEP]
have "set_to_nat D = 0"
[PROOF STATE]
proof (prove)
using this:
D = {}
sum ?g {} = (0::?'a)
set_to_nat D = sum ((^) 2) D

goal (1 subgoal):
 1. set_to_nat D = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat D = 0

goal (1 subgoal):
 1. finite D \<and> card D = 0 \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with zero_is_empty S3
[PROOF STATE]
proof (chain)
picking this:
nat_to_set 0 = {}
D = {}
set_to_nat D = 0
[PROOF STEP]
show "nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
using this:
nat_to_set 0 = {}
D = {}
set_to_nat D = 0

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
have P_at_Suc: "\<And> n. ?P n \<Longrightarrow> ?P (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
assume A_n: "?P n"
[PROOF STATE]
proof (state)
this:
\<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. \<And>n. \<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
show "?P (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
fix D
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
show "finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
assume A1: "finite D \<and> card D = Suc n"
[PROOF STATE]
proof (state)
this:
finite D \<and> card D = Suc n

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
finite D \<and> card D = Suc n
[PROOF STEP]
have S1: "finite D"
[PROOF STATE]
proof (prove)
using this:
finite D \<and> card D = Suc n

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

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
finite D \<and> card D = Suc n
[PROOF STEP]
have S2: "card D = Suc n"
[PROOF STATE]
proof (prove)
using this:
finite D \<and> card D = Suc n

goal (1 subgoal):
 1. card D = Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card D = Suc n

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
define m where "m = Max D"
[PROOF STATE]
proof (state)
this:
m = Max D

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from S2
[PROOF STATE]
proof (chain)
picking this:
card D = Suc n
[PROOF STEP]
have D_ne: "D \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
card D = Suc n

goal (1 subgoal):
 1. D \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D \<noteq> {}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with S1 m_def
[PROOF STATE]
proof (chain)
picking this:
finite D
m = Max D
D \<noteq> {}
[PROOF STEP]
have m_in: "m \<in> D"
[PROOF STATE]
proof (prove)
using this:
finite D
m = Max D
D \<noteq> {}

goal (1 subgoal):
 1. m \<in> D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m \<in> D

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
define D1 where "D1 = D - {m}"
[PROOF STATE]
proof (state)
this:
D1 = D - {m}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from S1 D1_def
[PROOF STATE]
proof (chain)
picking this:
finite D
D1 = D - {m}
[PROOF STEP]
have d1_finite: "finite D1"
[PROOF STATE]
proof (prove)
using this:
finite D
D1 = D - {m}

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

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from D1_def m_in S1
[PROOF STATE]
proof (chain)
picking this:
D1 = D - {m}
m \<in> D
finite D
[PROOF STEP]
have "card D1 = card D - 1"
[PROOF STATE]
proof (prove)
using this:
D1 = D - {m}
m \<in> D
finite D

goal (1 subgoal):
 1. card D1 = card D - 1
[PROOF STEP]
by (simp add: card_Diff_singleton)
[PROOF STATE]
proof (state)
this:
card D1 = card D - 1

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
card D = Suc n
card D1 = card D - 1
[PROOF STEP]
have card_d1: "card D1 = n"
[PROOF STATE]
proof (prove)
using this:
card D = Suc n
card D1 = card D - 1

goal (1 subgoal):
 1. card D1 = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card D1 = n

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from d1_finite card_d1
[PROOF STATE]
proof (chain)
picking this:
finite D1
card D1 = n
[PROOF STEP]
have "finite D1 \<and> card D1 = n"
[PROOF STATE]
proof (prove)
using this:
finite D1
card D1 = n

goal (1 subgoal):
 1. finite D1 \<and> card D1 = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite D1 \<and> card D1 = n

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with A_n
[PROOF STATE]
proof (chain)
picking this:
\<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D
finite D1 \<and> card D1 = n
[PROOF STEP]
have S3: "nat_to_set (set_to_nat D1) = D1"
[PROOF STATE]
proof (prove)
using this:
\<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D
finite D1 \<and> card D1 = n

goal (1 subgoal):
 1. nat_to_set (set_to_nat D1) = D1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D1) = D1

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
define u where "u = set_to_nat D"
[PROOF STATE]
proof (state)
this:
u = set_to_nat D

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
define u1 where "u1 = set_to_nat D1"
[PROOF STATE]
proof (state)
this:
u1 = set_to_nat D1

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from S1 m_in
[PROOF STATE]
proof (chain)
picking this:
finite D
m \<in> D
[PROOF STEP]
have "sum (\<lambda> (x::nat). (2::nat) ^ x) D = 2 ^ m + sum (\<lambda> x. 2 ^ x) (D - {m})"
[PROOF STATE]
proof (prove)
using this:
finite D
m \<in> D

goal (1 subgoal):
 1. sum ((^) 2) D = 2 ^ m + sum ((^) 2) (D - {m})
[PROOF STEP]
by (rule sum.remove)
[PROOF STATE]
proof (state)
this:
sum ((^) 2) D = 2 ^ m + sum ((^) 2) (D - {m})

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with set_to_nat_def
[PROOF STATE]
proof (chain)
picking this:
set_to_nat = sum ((^) 2)
sum ((^) 2) D = 2 ^ m + sum ((^) 2) (D - {m})
[PROOF STEP]
have "set_to_nat D = 2 ^ m + set_to_nat (D - {m})"
[PROOF STATE]
proof (prove)
using this:
set_to_nat = sum ((^) 2)
sum ((^) 2) D = 2 ^ m + sum ((^) 2) (D - {m})

goal (1 subgoal):
 1. set_to_nat D = 2 ^ m + set_to_nat (D - {m})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat D = 2 ^ m + set_to_nat (D - {m})

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
with u_def u1_def D1_def
[PROOF STATE]
proof (chain)
picking this:
u = set_to_nat D
u1 = set_to_nat D1
D1 = D - {m}
set_to_nat D = 2 ^ m + set_to_nat (D - {m})
[PROOF STEP]
have u_u1: "u = u1 + 2 ^ m"
[PROOF STATE]
proof (prove)
using this:
u = set_to_nat D
u1 = set_to_nat D1
D1 = D - {m}
set_to_nat D = 2 ^ m + set_to_nat (D - {m})

goal (1 subgoal):
 1. u = u1 + 2 ^ m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u = u1 + 2 ^ m

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from S3 u1_def
[PROOF STATE]
proof (chain)
picking this:
nat_to_set (set_to_nat D1) = D1
u1 = set_to_nat D1
[PROOF STEP]
have d1_u1: "nat_to_set u1 = D1"
[PROOF STATE]
proof (prove)
using this:
nat_to_set (set_to_nat D1) = D1
u1 = set_to_nat D1

goal (1 subgoal):
 1. nat_to_set u1 = D1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set u1 = D1

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
have u1_lt: "u1 < 2 ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
have L1: "D1 \<subseteq> {i. i<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D1 \<subseteq> {i. i < m}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> D1 \<Longrightarrow> x \<in> {i. i < m}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> D1 \<Longrightarrow> x \<in> {i. i < m}
[PROOF STEP]
assume A1: "x \<in> D1"
[PROOF STATE]
proof (state)
this:
x \<in> D1

goal (1 subgoal):
 1. \<And>x. x \<in> D1 \<Longrightarrow> x \<in> {i. i < m}
[PROOF STEP]
show "x \<in> {i. i<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {i. i < m}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x < m
[PROOF STEP]
from A1 D1_def
[PROOF STATE]
proof (chain)
picking this:
x \<in> D1
D1 = D - {m}
[PROOF STEP]
have L1_1: "x \<in> D"
[PROOF STATE]
proof (prove)
using this:
x \<in> D1
D1 = D - {m}

goal (1 subgoal):
 1. x \<in> D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> D

goal (1 subgoal):
 1. x < m
[PROOF STEP]
from S1 D_ne L1_1 m_def
[PROOF STATE]
proof (chain)
picking this:
finite D
D \<noteq> {}
x \<in> D
m = Max D
[PROOF STEP]
have L1_2: "x \<le> m"
[PROOF STATE]
proof (prove)
using this:
finite D
D \<noteq> {}
x \<in> D
m = Max D

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

goal (1 subgoal):
 1. x < m
[PROOF STEP]
with A1 L1_1 D1_def
[PROOF STATE]
proof (chain)
picking this:
x \<in> D1
x \<in> D
D1 = D - {m}
x \<le> m
[PROOF STEP]
have "x \<noteq> m"
[PROOF STATE]
proof (prove)
using this:
x \<in> D1
x \<in> D
D1 = D - {m}
x \<le> m

goal (1 subgoal):
 1. x \<noteq> m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> m

goal (1 subgoal):
 1. x < m
[PROOF STEP]
with L1_2
[PROOF STATE]
proof (chain)
picking this:
x \<le> m
x \<noteq> m
[PROOF STEP]
show "x < m"
[PROOF STATE]
proof (prove)
using this:
x \<le> m
x \<noteq> m

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> {i. i < m}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
D1 \<subseteq> {i. i < m}

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
have L2: "finite {i. i<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i < m}
[PROOF STEP]
by (rule finite_interval)
[PROOF STATE]
proof (state)
this:
finite {i. i < m}

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
from L2 L1
[PROOF STATE]
proof (chain)
picking this:
finite {i. i < m}
D1 \<subseteq> {i. i < m}
[PROOF STEP]
have "set_to_nat D1 \<le> set_to_nat {i. i<m}"
[PROOF STATE]
proof (prove)
using this:
finite {i. i < m}
D1 \<subseteq> {i. i < m}

goal (1 subgoal):
 1. set_to_nat D1 \<le> set_to_nat {i. i < m}
[PROOF STEP]
by (rule set_to_nat_mono)
[PROOF STATE]
proof (state)
this:
set_to_nat D1 \<le> set_to_nat {i. i < m}

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
with u1_def
[PROOF STATE]
proof (chain)
picking this:
u1 = set_to_nat D1
set_to_nat D1 \<le> set_to_nat {i. i < m}
[PROOF STEP]
have "u1 \<le> set_to_nat {i. i<m}"
[PROOF STATE]
proof (prove)
using this:
u1 = set_to_nat D1
set_to_nat D1 \<le> set_to_nat {i. i < m}

goal (1 subgoal):
 1. u1 \<le> set_to_nat {i. i < m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u1 \<le> set_to_nat {i. i < m}

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
with set_to_nat_of_interval
[PROOF STATE]
proof (chain)
picking this:
set_to_nat {i. i < ?m} = 2 ^ ?m - 1
u1 \<le> set_to_nat {i. i < m}
[PROOF STEP]
have L3: "u1 \<le> 2 ^ m - 1"
[PROOF STATE]
proof (prove)
using this:
set_to_nat {i. i < ?m} = 2 ^ ?m - 1
u1 \<le> set_to_nat {i. i < m}

goal (1 subgoal):
 1. u1 \<le> 2 ^ m - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u1 \<le> 2 ^ m - 1

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
have "0 < (2::nat) ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2 ^ m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 2 ^ m

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < 2 ^ m
[PROOF STEP]
have "(2::nat) ^ m - 1 < (2::nat) ^ m"
[PROOF STATE]
proof (prove)
using this:
0 < 2 ^ m

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

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
with L3
[PROOF STATE]
proof (chain)
picking this:
u1 \<le> 2 ^ m - 1
2 ^ m - 1 < 2 ^ m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u1 \<le> 2 ^ m - 1
2 ^ m - 1 < 2 ^ m

goal (1 subgoal):
 1. u1 < 2 ^ m
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
u1 < 2 ^ m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u1 < 2 ^ m

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from u_def
[PROOF STATE]
proof (chain)
picking this:
u = set_to_nat D
[PROOF STEP]
have "nat_to_set (set_to_nat D) = nat_to_set u"
[PROOF STATE]
proof (prove)
using this:
u = set_to_nat D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = nat_to_set u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = nat_to_set u

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = nat_to_set u

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from u_u1
[PROOF STATE]
proof (chain)
picking this:
u = u1 + 2 ^ m
[PROOF STEP]
have "\<dots> = nat_to_set (u1 + 2 ^ m)"
[PROOF STATE]
proof (prove)
using this:
u = u1 + 2 ^ m

goal (1 subgoal):
 1. nat_to_set u = nat_to_set (u1 + 2 ^ m)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set u = nat_to_set (u1 + 2 ^ m)

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_to_set u = nat_to_set (u1 + 2 ^ m)

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from u1_lt
[PROOF STATE]
proof (chain)
picking this:
u1 < 2 ^ m
[PROOF STEP]
have "\<dots> = nat_to_set u1 \<union> {m}"
[PROOF STATE]
proof (prove)
using this:
u1 < 2 ^ m

goal (1 subgoal):
 1. nat_to_set (u1 + 2 ^ m) = nat_to_set u1 \<union> {m}
[PROOF STEP]
by (rule add_power)
[PROOF STATE]
proof (state)
this:
nat_to_set (u1 + 2 ^ m) = nat_to_set u1 \<union> {m}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_to_set (u1 + 2 ^ m) = nat_to_set u1 \<union> {m}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from d1_u1
[PROOF STATE]
proof (chain)
picking this:
nat_to_set u1 = D1
[PROOF STEP]
have "\<dots> = D1 \<union> {m}"
[PROOF STATE]
proof (prove)
using this:
nat_to_set u1 = D1

goal (1 subgoal):
 1. nat_to_set u1 \<union> {m} = D1 \<union> {m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set u1 \<union> {m} = D1 \<union> {m}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat_to_set u1 \<union> {m} = D1 \<union> {m}

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from D1_def m_in
[PROOF STATE]
proof (chain)
picking this:
D1 = D - {m}
m \<in> D
[PROOF STEP]
have "\<dots> = D"
[PROOF STATE]
proof (prove)
using this:
D1 = D - {m}
m \<in> D

goal (1 subgoal):
 1. D1 \<union> {m} = D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D1 \<union> {m} = D

goal (1 subgoal):
 1. finite D \<and> card D = Suc n \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nat_to_set (set_to_nat D) = D
[PROOF STEP]
show "nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
using this:
nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>D. finite D \<and> card D = Suc n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc ?n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from P_at_0 P_at_Suc
[PROOF STATE]
proof (chain)
picking this:
\<forall>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc ?n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
have main: "\<And> n. ?P n"
[PROOF STATE]
proof (prove)
using this:
\<forall>D. finite D \<and> card D = 0 \<longrightarrow> nat_to_set (set_to_nat D) = D
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D \<Longrightarrow> \<forall>D. finite D \<and> card D = Suc ?n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. \<And>n. \<forall>D. finite D \<and> card D = n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
by (rule nat.induct)
[PROOF STATE]
proof (state)
this:
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. finite D \<Longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
from A main
[PROOF STATE]
proof (chain)
picking this:
finite D
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite D
\<forall>D. finite D \<and> card D = ?n \<longrightarrow> nat_to_set (set_to_nat D) = D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_eq_zero_iff:
  assumes "summable f" and pos: "\<And>n. 0 \<le> f n"
  shows "suminf f = 0 \<longleftrightarrow> (\<forall>n. f n = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (suminf f = (0::'a)) = (\<forall>n. f n = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
assume L: "suminf f = 0"
[PROOF STATE]
proof (state)
this:
suminf f = (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
suminf f = (0::'a)
[PROOF STEP]
have f: "(\<lambda>n. \<Sum>i<n. f i) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
suminf f = (0::'a)

goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using summable_LIMSEQ[of f] assms
[PROOF STATE]
proof (prove)
using this:
suminf f = (0::'a)
summable f \<Longrightarrow> (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> suminf f
summable f
(0::'a) \<le> f ?n

goal (1 subgoal):
 1. (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
have "\<And>i. (\<Sum>n\<in>{i}. f n) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum f {..<n}) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. \<And>i. sum f {i} \<le> (0::'a)
[PROOF STEP]
by (metis L \<open>summable f\<close> order_refl pos sum.infinite sum_le_suminf)
[PROOF STATE]
proof (state)
this:
sum f {?i} \<le> (0::'a)

goal (2 subgoals):
 1. suminf f = (0::'a) \<Longrightarrow> \<forall>n. f n = (0::'a)
 2. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
with pos
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> f ?n
sum f {?i} \<le> (0::'a)
[PROOF STEP]
show "\<forall>n. f n = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> f ?n
sum f {?i} \<le> (0::'a)

goal (1 subgoal):
 1. \<forall>n. f n = (0::'a)
[PROOF STEP]
by (simp add: order.antisym)
[PROOF STATE]
proof (state)
this:
\<forall>n. f n = (0::'a)

goal (1 subgoal):
 1. \<forall>n. f n = (0::'a) \<Longrightarrow> suminf f = (0::'a)
[PROOF STEP]
qed (metis suminf_zero fun_eq_iff)


[STATEMENT]
lemma null_ccsqrt [simp]:
  shows "ccsqrt x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ccsqrt x = 0) = (x = 0)
[PROOF STEP]
unfolding ccsqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rcis (sqrt (cmod x)) (Arg x / 2) = 0) = (x = 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma orthogonal_spaces_ccspan: \<open>(\<forall>x\<in>S. \<forall>y\<in>T. is_orthogonal x y) \<longleftrightarrow> orthogonal_spaces (ccspan S) (ccspan T)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>S. \<forall>y\<in>T. is_orthogonal x y) = orthogonal_spaces (ccspan S) (ccspan T)
[PROOF STEP]
by (meson ccspan_leq_ortho_ccspan ccspan_superset orthogonal_spaces_def orthogonal_spaces_leq_compl subset_iff)


[STATEMENT]
lemma mat_max_index:
  assumes "i < dim_row A" "j < dim_col A"
  shows "(mat_max A B) $$ (i,j) = max (A $$ (i,j)) (B $$ (i,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max\<^sub>m A B $$ (i, j) = max (A $$ (i, j)) (B $$ (i, j))
[PROOF STEP]
unfolding mat_max_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row A) (dim_col A) (\<lambda>ij. max (A $$ ij) (B $$ ij)) $$ (i, j) = max (A $$ (i, j)) (B $$ (i, j))
[PROOF STEP]
using index_mat assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat ?nr ?nc ?f $$ (?i, ?j) = ?f (?i, ?j)
\<lbrakk>?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> mat\<^sub>r ?nr ?nc ?g $$ (?i, ?j) = ?g ?i $ ?j
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. mat (dim_row A) (dim_col A) (\<lambda>ij. max (A $$ ij) (B $$ ij)) $$ (i, j) = max (A $$ (i, j)) (B $$ (i, j))
[PROOF STEP]
by auto


[STATEMENT]
lemma dconvfactor_inverse:
  "dconvfactor c (inverse d) = inverse (dconvfactor c d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dconvfactor c (inverse d) = inverse (dconvfactor c d)
[PROOF STEP]
by (simp add: dconvfactor_def inverse_dimvec_def intpow_uminus)