[STATEMENT]
lemma iso_kernel_image:
  assumes "group G" "group H"
  shows "f \<in> iso G H \<longleftrightarrow> f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> Group.iso G H) = (f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H)
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. f \<in> Group.iso G H \<Longrightarrow> f \<in> hom G H
 2. f \<in> Group.iso G H \<Longrightarrow> kernel G H f = {\<one>\<^bsub>G\<^esub>}
 3. f \<in> Group.iso G H \<Longrightarrow> f ` carrier G = carrier H
 4. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
assume f: ?lhs
[PROOF STATE]
proof (state)
this:
f \<in> Group.iso G H

goal (4 subgoals):
 1. f \<in> Group.iso G H \<Longrightarrow> f \<in> hom G H
 2. f \<in> Group.iso G H \<Longrightarrow> kernel G H f = {\<one>\<^bsub>G\<^esub>}
 3. f \<in> Group.iso G H \<Longrightarrow> f ` carrier G = carrier H
 4. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
show "f \<in> hom G H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> hom G H
[PROOF STEP]
using Group.iso_iff f
[PROOF STATE]
proof (prove)
using this:
(?h \<in> Group.iso ?G ?H) = (?h \<in> hom ?G ?H \<and> ?h ` carrier ?G = carrier ?H \<and> inj_on ?h (carrier ?G))
f \<in> Group.iso G H

goal (1 subgoal):
 1. f \<in> hom G H
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<in> hom G H

goal (3 subgoals):
 1. f \<in> Group.iso G H \<Longrightarrow> kernel G H f = {\<one>\<^bsub>G\<^esub>}
 2. f \<in> Group.iso G H \<Longrightarrow> f ` carrier G = carrier H
 3. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
show "kernel G H f = {\<one>\<^bsub>G\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kernel G H f = {\<one>\<^bsub>G\<^esub>}
[PROOF STEP]
using assms f Group.group_def hom_one
[PROOF STATE]
proof (prove)
using this:
Group.group G
Group.group H
f \<in> Group.iso G H
Group.group ?G \<equiv> Group.monoid ?G \<and> Group.group_axioms ?G
\<lbrakk>?h \<in> hom ?G ?H; Group.group ?G; Group.group ?H\<rbrakk> \<Longrightarrow> ?h \<one>\<^bsub>?G\<^esub> = \<one>\<^bsub>?H\<^esub>

goal (1 subgoal):
 1. kernel G H f = {\<one>\<^bsub>G\<^esub>}
[PROOF STEP]
by (fastforce simp add: kernel_def iso_iff_mon_epi mon_iff_hom_one set_eq_iff)
[PROOF STATE]
proof (state)
this:
kernel G H f = {\<one>\<^bsub>G\<^esub>}

goal (2 subgoals):
 1. f \<in> Group.iso G H \<Longrightarrow> f ` carrier G = carrier H
 2. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
show "f ` carrier G = carrier H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` carrier G = carrier H
[PROOF STEP]
by (meson Group.iso_iff f)
[PROOF STATE]
proof (state)
this:
f ` carrier G = carrier H

goal (1 subgoal):
 1. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H

goal (1 subgoal):
 1. f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H \<Longrightarrow> f \<in> Group.iso G H
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Group.group G
Group.group H
f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
Group.group G
Group.group H
f \<in> hom G H \<and> kernel G H f = {\<one>\<^bsub>G\<^esub>} \<and> f ` carrier G = carrier H

goal (1 subgoal):
 1. f \<in> Group.iso G H
[PROOF STEP]
by (auto simp: kernel_def iso_def bij_betw_def inj_on_one_iff')
[PROOF STATE]
proof (state)
this:
f \<in> Group.iso G H

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_shift_to_fls [simp]:
  "n \<le> subdegree f \<Longrightarrow> fps_to_fls (fps_shift n f) = fls_shift (int n) (fps_to_fls f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> subdegree f \<Longrightarrow> fps_to_fls (fps_shift n f) = fls_shift (int n) (fps_to_fls f)
[PROOF STEP]
by (auto intro: fls_eqI simp: nat_add_distrib nth_less_subdegree_zero)


[STATEMENT]
lemma Cauchy_Schwarz_ineq2:
  shows "norm (cinner x y) \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (cinner x y) \<le> norm x * norm y
[PROOF STEP]
proof (rule power2_le_imp_le)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "(norm (cinner x y))^2 = Re (cinner x y * cinner y x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (cinner x y))\<^sup>2 = Re (cinner x y * cinner y x)
[PROOF STEP]
by (metis (full_types) Re_complex_of_real complex_norm_square local.cinner_commute)
[PROOF STATE]
proof (state)
this:
(cmod (cinner x y))\<^sup>2 = Re (cinner x y * cinner y x)

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(cmod (cinner x y))\<^sup>2 = Re (cinner x y * cinner y x)

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "\<dots> \<le> Re (cinner x x * cinner y y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (cinner x y * cinner y x) \<le> Re (cinner x x * cinner y y)
[PROOF STEP]
using Cauchy_Schwarz_ineq
[PROOF STATE]
proof (prove)
using this:
cinner ?x ?y * cinner ?y ?x \<le> cinner ?x ?x * cinner ?y ?y

goal (1 subgoal):
 1. Re (cinner x y * cinner y x) \<le> Re (cinner x x * cinner y y)
[PROOF STEP]
by (rule Re_mono)
[PROOF STATE]
proof (state)
this:
Re (cinner x y * cinner y x) \<le> Re (cinner x x * cinner y y)

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (cinner x y * cinner y x) \<le> Re (cinner x x * cinner y y)

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "\<dots> = Re (complex_of_real ((norm x)^2) * complex_of_real ((norm y)^2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (cinner x x * cinner y y) = Re (complex_of_real ((norm x)\<^sup>2) * complex_of_real ((norm y)\<^sup>2))
[PROOF STEP]
by (simp add: power2_norm_eq_cinner)
[PROOF STATE]
proof (state)
this:
Re (cinner x x * cinner y y) = Re (complex_of_real ((norm x)\<^sup>2) * complex_of_real ((norm y)\<^sup>2))

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Re (cinner x x * cinner y y) = Re (complex_of_real ((norm x)\<^sup>2) * complex_of_real ((norm y)\<^sup>2))

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "\<dots> = (norm x * norm y)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (complex_of_real ((norm x)\<^sup>2) * complex_of_real ((norm y)\<^sup>2)) = (norm x * norm y)\<^sup>2
[PROOF STEP]
by (simp add: power_mult_distrib)
[PROOF STATE]
proof (state)
this:
Re (complex_of_real ((norm x)\<^sup>2) * complex_of_real ((norm y)\<^sup>2)) = (norm x * norm y)\<^sup>2

goal (2 subgoals):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
[PROOF STEP]
show "(cmod (cinner x y))^2 \<le> (norm x * norm y)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2

goal (1 subgoal):
 1. (cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(cmod (cinner x y))\<^sup>2 \<le> (norm x * norm y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
show "0 \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
by (simp add: local.norm_eq_sqrt_cinner)
[PROOF STATE]
proof (state)
this:
0 \<le> norm x * norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugation_of_cycle:
  assumes "cycle cs" and "bij p"
  shows "p \<circ> (cycle_of_list cs) \<circ> (inv p) = cycle_of_list (map p cs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<circ> cycle_of_list cs \<circ> inv p = cycle_of_list (map p cs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cycle cs
bij p

goal (1 subgoal):
 1. p \<circ> cycle_of_list cs \<circ> inv p = cycle_of_list (map p cs)
[PROOF STEP]
proof (induction cs rule: cycle_of_list.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
case (1 i j cs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs))
cycle (i # j # cs)
bij p

goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
have "p \<circ> cycle_of_list (i # j # cs) \<circ> inv p =
       (p \<circ> (transpose i j) \<circ> inv p) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)
[PROOF STEP]
by (simp add: assms(2) bij_is_inj fun.map_comp)
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)

goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)

goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
have " ... = (transpose (p i) (p j)) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p) = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)
[PROOF STEP]
using "1.prems"(2)
[PROOF STATE]
proof (prove)
using this:
bij p

goal (1 subgoal):
 1. p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p) = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)
[PROOF STEP]
by (simp add: bij_inv_eq_iff transpose_apply_commute fun_eq_iff bij_betw_inv_into_left)
[PROOF STATE]
proof (state)
this:
p \<circ> Transposition.transpose i j \<circ> inv p \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p) = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)

goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)
[PROOF STEP]
have "p \<circ> cycle_of_list (i # j # cs) \<circ> inv p =
               (transpose (p i) (p j)) \<circ> (cycle_of_list (map p (j # cs)))"
[PROOF STATE]
proof (prove)
using this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)

goal (1 subgoal):
 1. p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> cycle_of_list (map p (j # cs))
[PROOF STEP]
using "1.IH" "1.prems"(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> (p \<circ> cycle_of_list (j # cs) \<circ> inv p)
\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs))
cycle (i # j # cs)
bij p

goal (1 subgoal):
 1. p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> cycle_of_list (map p (j # cs))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> cycle_of_list (map p (j # cs))

goal (3 subgoals):
 1. \<And>i j cs. \<lbrakk>\<lbrakk>cycle (j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (j # cs) \<circ> inv p = cycle_of_list (map p (j # cs)); cycle (i # j # cs); bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
 2. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 3. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = Transposition.transpose (p i) (p j) \<circ> cycle_of_list (map p (j # cs))

goal (1 subgoal):
 1. p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list (i # j # cs) \<circ> inv p = cycle_of_list (map p (i # j # cs))

goal (2 subgoals):
 1. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 2. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 2. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
case "2_1"
[PROOF STATE]
proof (state)
this:
cycle []
bij p

goal (2 subgoals):
 1. \<lbrakk>cycle []; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
 2. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
cycle []
bij p

goal (1 subgoal):
 1. p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])
[PROOF STEP]
by (metis bij_is_surj comp_id cycle_of_list.simps(2) list.simps(8) surj_iff)
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list [] \<circ> inv p = cycle_of_list (map p [])

goal (1 subgoal):
 1. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
case "2_2"
[PROOF STATE]
proof (state)
this:
cycle [v_]
bij p

goal (1 subgoal):
 1. \<And>v. \<lbrakk>cycle [v]; bij p\<rbrakk> \<Longrightarrow> p \<circ> cycle_of_list [v] \<circ> inv p = cycle_of_list (map p [v])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
cycle [v_]
bij p

goal (1 subgoal):
 1. p \<circ> cycle_of_list [v_] \<circ> inv p = cycle_of_list (map p [v_])
[PROOF STEP]
by (metis bij_is_surj comp_id cycle_of_list.simps(3) list.simps(8) list.simps(9) surj_iff)
[PROOF STATE]
proof (state)
this:
p \<circ> cycle_of_list [v_] \<circ> inv p = cycle_of_list (map p [v_])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powa_gt_zero:
  assumes "a \<ge> 1"
  shows "a powa x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
obtain y where 1: "(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using LIMSEQ_powrat_incseq_of_ex1 assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?a \<Longrightarrow> \<exists>!y. (\<lambda>n. ?a pow\<^sub>\<rat> incseq_of ?x n) \<longlonglongrightarrow> y
1 \<le> a

goal (1 subgoal):
 1. (\<And>y. (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
have "incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)
[PROOF STEP]
by (simp add: assms incseq_powrat_insec_of)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y
incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)
[PROOF STEP]
have "y > 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y
incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)

goal (1 subgoal):
 1. 0 < y
[PROOF STEP]
using assms incseq_le powrat_gt_zero
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y
incseq (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n)
1 \<le> a
\<lbrakk>incseq ?X; ?X \<longlonglongrightarrow> ?L\<rbrakk> \<Longrightarrow> ?X ?n \<le> ?L
0 < ?x \<Longrightarrow> 0 < ?x pow\<^sub>\<rat> ?r

goal (1 subgoal):
 1. 0 < y
[PROOF STEP]
by (metis less_le_trans zero_less_one)
[PROOF STATE]
proof (state)
this:
0 < y

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < y

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
using powa_def 1
[PROOF STATE]
proof (prove)
using this:
0 < y
?a powa ?x = (THE y. (\<lambda>n. ?a pow\<^sub>\<rat> incseq_of ?x n) \<longlonglongrightarrow> y)
(\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. 0 < a powa x
[PROOF STEP]
by (metis Lim_def limI)
[PROOF STATE]
proof (state)
this:
0 < a powa x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjoint_affine_hull:
  fixes s :: "'n::euclidean_space set"
  assumes "\<not> affine_dependent s" "t \<subseteq> s" "u \<subseteq> s" "t \<inter> u = {}"
    shows "(affine hull t) \<inter> (affine hull u) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent s
[PROOF STEP]
have "finite s"
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent s

goal (1 subgoal):
 1. finite s
[PROOF STEP]
by (simp add: aff_independent_finite)
[PROOF STATE]
proof (state)
this:
finite s

goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
with assms(2,3)
[PROOF STATE]
proof (chain)
picking this:
t \<subseteq> s
u \<subseteq> s
finite s
[PROOF STEP]
have "finite t" "finite u"
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> s
u \<subseteq> s
finite s

goal (1 subgoal):
 1. finite t &&& finite u
[PROOF STEP]
by (blast intro: finite_subset)+
[PROOF STATE]
proof (state)
this:
finite t
finite u

goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
have False if "y \<in> affine hull t" and "y \<in> affine hull u" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
y \<in> affine hull t
y \<in> affine hull u
[PROOF STEP]
obtain a b
      where a1 [simp]: "sum a t = 1"
        and [simp]: "sum (\<lambda>v. a v *\<^sub>R v) t = y"
        and [simp]: "sum b u = 1" "sum (\<lambda>v. b v *\<^sub>R v) u = y"
[PROOF STATE]
proof (prove)
using this:
y \<in> affine hull t
y \<in> affine hull u

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>sum a t = 1; (\<Sum>v\<in>t. a v *\<^sub>R v) = y; sum b u = 1; (\<Sum>v\<in>u. b v *\<^sub>R v) = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: affine_hull_finite \<open>finite t\<close> \<open>finite u\<close>)
[PROOF STATE]
proof (state)
this:
sum a t = 1
(\<Sum>v\<in>t. a v *\<^sub>R v) = y
sum b u = 1
(\<Sum>v\<in>u. b v *\<^sub>R v) = y

goal (1 subgoal):
 1. False
[PROOF STEP]
define c where "c x = (if x \<in> t then a x else if x \<in> u then -(b x) else 0)" for x
[PROOF STATE]
proof (state)
this:
c ?x = (if ?x \<in> t then a ?x else if ?x \<in> u then - b ?x else 0)

goal (1 subgoal):
 1. False
[PROOF STEP]
from assms(2,3,4)
[PROOF STATE]
proof (chain)
picking this:
t \<subseteq> s
u \<subseteq> s
t \<inter> u = {}
[PROOF STEP]
have [simp]: "s \<inter> t = t" "s \<inter> - t \<inter> u = u"
[PROOF STATE]
proof (prove)
using this:
t \<subseteq> s
u \<subseteq> s
t \<inter> u = {}

goal (1 subgoal):
 1. s \<inter> t = t &&& s \<inter> - t \<inter> u = u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s \<inter> t = t
s \<inter> - t \<inter> u = u

goal (1 subgoal):
 1. False
[PROOF STEP]
have "sum c s = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum c s = 0
[PROOF STEP]
by (simp add: c_def comm_monoid_add_class.sum.If_cases \<open>finite s\<close> sum_negf)
[PROOF STATE]
proof (state)
this:
sum c s = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum c s = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
have "\<not> (\<forall>v\<in>s. c v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>v\<in>s. c v = 0)
[PROOF STEP]
by (metis (no_types) IntD1 \<open>s \<inter> t = t\<close> a1 c_def sum.neutral zero_neq_one)
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>v\<in>s. c v = 0)

goal (1 subgoal):
 1. False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>v\<in>s. c v = 0)

goal (1 subgoal):
 1. False
[PROOF STEP]
have "(\<Sum>v\<in>s. c v *\<^sub>R v) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>s. c v *\<^sub>R v) = (0::'n)
[PROOF STEP]
by (simp add: c_def if_smult sum_negf comm_monoid_add_class.sum.If_cases \<open>finite s\<close>)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>s. c v *\<^sub>R v) = (0::'n)

goal (1 subgoal):
 1. False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum c s = 0
\<not> (\<forall>v\<in>s. c v = 0)
(\<Sum>v\<in>s. c v *\<^sub>R v) = (0::'n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum c s = 0
\<not> (\<forall>v\<in>s. c v = 0)
(\<Sum>v\<in>s. c v *\<^sub>R v) = (0::'n)

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(1) \<open>finite s\<close>
[PROOF STATE]
proof (prove)
using this:
sum c s = 0
\<not> (\<forall>v\<in>s. c v = 0)
(\<Sum>v\<in>s. c v *\<^sub>R v) = (0::'n)
\<not> affine_dependent s
finite s

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y \<in> affine hull t; ?y \<in> affine hull u\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?y \<in> affine hull t; ?y \<in> affine hull u\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> affine hull t; ?y \<in> affine hull u\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. affine hull t \<inter> affine hull u = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
affine hull t \<inter> affine hull u = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem B_trusts_NS3:
     "\<lbrakk>Says B A  (Crypt (pubEK A) \<lbrace>Nonce NA, Nonce NB\<rbrace>) \<in> set evs;
       Says A' B (Crypt (pubEK B) (Nonce NB)) \<in> set evs;
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_public\<rbrakk>
      \<Longrightarrow> \<exists>C. Says A C (Crypt (pubEK C) (Nonce NB)) \<in> set evs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Says B A (Crypt (pubK A) \<lbrace>Nonce NA, Nonce NB\<rbrace>) \<in> set evs; Says A' B (Crypt (pubK B) (Nonce NB)) \<in> set evs; A \<notin> bad; B \<notin> bad; evs \<in> ns_public\<rbrakk> \<Longrightarrow> \<exists>C. Says A C (Crypt (pubK C) (Nonce NB)) \<in> set evs
[PROOF STEP]
by (blast intro: B_trusts_NS3_lemma)


[STATEMENT]
lemma "eval INTEG INTEG id 10 (monom (UP INTEG) 5 2) = 500"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval INTEG INTEG id 10 (monom (UP INTEG) 5 2) = 500
[PROOF STEP]
by (simp add: INTEG.eval_monom)


[STATEMENT]
lemma binomial_ngt_diff:
  "(n choose Suc n) = (Suc n choose Suc n) - (n choose n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose Suc n = Suc n choose Suc n - (n choose n)
[PROOF STEP]
by (subst binomial_Suc_Suc, arith)


[STATEMENT]
lemma UN_singleton_image: "(\<Union>x\<in>A. {f x}) = f ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>A. {f x}) = f ` A
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_dioph_div_mod:
  "(eval_dioph ks xs = l) =
   (eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and>
    eval_dioph ks (map (\<lambda>x. x div 2) xs) =
      (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval_dioph ks xs = l) = (eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
assume eq: ?l
[PROOF STATE]
proof (state)
this:
eval_dioph ks xs = l

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks xs = l
[PROOF STEP]
have "eval_dioph ks xs mod 2 = l mod 2"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks xs = l

goal (1 subgoal):
 1. eval_dioph ks xs mod 2 = l mod 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks xs mod 2 = l mod 2

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
with eval_dioph_mod [of _ _ 2]
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ?ks ?xs mod int 2 = eval_dioph ?ks (map (\<lambda>x. x mod 2) ?xs) mod int 2
eval_dioph ks xs mod 2 = l mod 2
[PROOF STEP]
have eq': "eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ?ks ?xs mod int 2 = eval_dioph ?ks (map (\<lambda>x. x mod 2) ?xs) mod int 2
eval_dioph ks xs mod 2 = l mod 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
from eval_dioph_div_mult [symmetric, of ks xs 2] eq
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks xs = eval_dioph ks (map (\<lambda>x. x div 2) xs) * int 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs)
eval_dioph ks xs = l
[PROOF STEP]
have "eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs) = l"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks xs = eval_dioph ks (map (\<lambda>x. x div 2) xs) * int 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs)
eval_dioph ks xs = l

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs) = l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs) = l

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs) = l
[PROOF STEP]
have "eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + eval_dioph ks (map (\<lambda>x. x mod 2) xs) = l

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)
[PROOF STEP]
by (simp add: eq_diff_eq)
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)
[PROOF STEP]
have "(eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2) div 2 =
    (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 div 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 div 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (2 subgoals):
 1. eval_dioph ks xs = l \<Longrightarrow> eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
 2. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
with eq'
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 div 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 div 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
assume ?r (is "?r1 \<and> ?r2")
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
[PROOF STEP]
obtain eq1: ?r1 and eq2: ?r2
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. (\<lbrakk>eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2; eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2
eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
from eq1
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2
[PROOF STEP]
have "(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2) mod 2 =
    (l - l mod 2) mod 2"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2

goal (1 subgoal):
 1. (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2) mod 2 = (l - l mod 2) mod 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2) mod 2 = (l - l mod 2) mod 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2) mod 2 = (l - l mod 2) mod 2
[PROOF STEP]
have "(l mod 2 - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 mod 2) mod 2 =
    (l mod 2 - l mod 2 mod 2) mod 2"
[PROOF STATE]
proof (prove)
using this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2) mod 2 = (l - l mod 2) mod 2

goal (1 subgoal):
 1. (l mod 2 - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 mod 2) mod 2 = (l mod 2 - l mod 2 mod 2) mod 2
[PROOF STEP]
by (simp only: mod_diff_eq)
[PROOF STATE]
proof (state)
this:
(l mod 2 - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 mod 2) mod 2 = (l mod 2 - l mod 2 mod 2) mod 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(l mod 2 - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 mod 2) mod 2 = (l mod 2 - l mod 2 mod 2) mod 2
[PROOF STEP]
have eq1': "(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = 0"
[PROOF STATE]
proof (prove)
using this:
(l mod 2 - eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 mod 2) mod 2 = (l mod 2 - l mod 2 mod 2) mod 2

goal (1 subgoal):
 1. (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = 0
[PROOF STEP]
by (simp add: mod_diff_eq)
[PROOF STATE]
proof (state)
this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = 0

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
from eq2
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2
[PROOF STEP]
have
    "eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 +
     (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 =
     (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 * 2 +
     (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2
[PROOF STEP]
have
    "eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 +
     (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 =
     l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)"
[PROOF STATE]
proof (prove)
using this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)

goal (1 subgoal):
 1. eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2 \<Longrightarrow> eval_dioph ks xs = l
[PROOF STEP]
with eq1' eval_dioph_div_mult [of _ 2]
[PROOF STATE]
proof (chain)
picking this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = 0
eval_dioph ?ks (map (\<lambda>x. x div 2) ?xs) * int 2 + eval_dioph ?ks (map (\<lambda>x. x mod 2) ?xs) = eval_dioph ?ks ?xs
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
using this:
(l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = 0
eval_dioph ?ks (map (\<lambda>x. x div 2) ?xs) * int 2 + eval_dioph ?ks (map (\<lambda>x. x mod 2) ?xs) = eval_dioph ?ks ?xs
eval_dioph ks (map (\<lambda>x. x div 2) xs) * 2 + (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) mod 2 = l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)

goal (1 subgoal):
 1. eval_dioph ks xs = l
[PROOF STEP]
by (simp add: eq_diff_eq)
[PROOF STATE]
proof (state)
this:
eval_dioph ks xs = l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closest_point_dot:
  assumes "convex S" "closed S" "x \<in> S"
  shows "inner (a - closest_point S a) (x - closest_point S a) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - closest_point S a) \<bullet> (x - closest_point S a) \<le> 0
[PROOF STEP]
using any_closest_point_dot[OF assms(1,2) _ assms(3)]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; \<forall>z\<in>S. dist ?a ?x \<le> dist ?a z\<rbrakk> \<Longrightarrow> (?a - ?x) \<bullet> (x - ?x) \<le> 0

goal (1 subgoal):
 1. (a - closest_point S a) \<bullet> (x - closest_point S a) \<le> 0
[PROOF STEP]
by (metis assms(2) assms(3) closest_point_in_set closest_point_le empty_iff)


[STATEMENT]
lemma key_sets_crypt_1:
 "X \<noteq> Crypt K Y \<Longrightarrow>
    key_sets X {Crypt K Y} \<subseteq> insert (InvKey K) ` key_sets X {Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<noteq> Crypt K Y \<Longrightarrow> key_sets X {Crypt K Y} \<subseteq> insert (InvKey K) ` key_sets X {Y}
[PROOF STEP]
by (rule subsetI, simp add: key_sets_def, erule exE, rotate_tac, erule rev_mp,
 rule list.induct, auto)


[STATEMENT]
lemma set_integrable_mult_right [simp, intro]:
  fixes a :: "'a::{real_normed_field, second_countable_topology}"
  shows "(a \<noteq> 0 \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a * f t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> (0::'a) \<Longrightarrow> set_integrable M A f) \<Longrightarrow> set_integrable M A (\<lambda>t. a * f t)
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<noteq> (0::'a) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R (a * f x))
[PROOF STEP]
using integrable_mult_right[of a M "\<lambda>x. indicator A x *\<^sub>R f x"]
[PROOF STATE]
proof (prove)
using this:
(a \<noteq> (0::'a) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. a * indicat_real A x *\<^sub>R f x)

goal (1 subgoal):
 1. (a \<noteq> (0::'a) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)) \<Longrightarrow> integrable M (\<lambda>x. indicat_real A x *\<^sub>R (a * f x))
[PROOF STEP]
by simp


[STATEMENT]
lemma snd_snd_Gauss_Jordan_column_k_PA_eq:
shows "snd (snd (Gauss_Jordan_column_k_PA (P,i,A) k)) = snd (Gauss_Jordan_column_k (i,A) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (Gauss_Jordan_column_k_PA (P, i, A) k)) = snd (Gauss_Jordan_column_k (i, A) k)
[PROOF STEP]
unfolding Gauss_Jordan_column_k_PA_def Gauss_Jordan_column_k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (let Pa = fst (P, i, A); ia = fst (snd (P, i, A)); A = snd (snd (P, i, A)); from_nat_i = mod_type_class.from_nat ia; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> ia = nrows A then (Pa, ia, A) else let Gauss = Gauss_Jordan_in_ij_PA (Pa, A) from_nat_i from_nat_k in (fst Gauss, ia + 1, snd Gauss))) = snd (let ia = fst (i, A); A = snd (i, A); from_nat_i = mod_type_class.from_nat ia; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> ia = nrows A then (ia, A) else (ia + 1, Gauss_Jordan_in_ij A from_nat_i from_nat_k))
[PROOF STEP]
unfolding Let_def snd_conv fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k))))) = snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (i, A) else (i + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))
[PROOF STEP]
unfolding snd_Gauss_Jordan_in_ij_PA_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) = snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (i, A) else (i + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))
[PROOF STEP]
by auto


[STATEMENT]
lemma A1n_commute: "A1n ** A = A ** A1n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1n ** A = A ** A1n
[PROOF STEP]
unfolding A1n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matpow (A + mat 1) N ** A = A ** matpow (A + mat 1) N
[PROOF STEP]
by (rule matpow_1_commute)


[STATEMENT]
lemma algebraic_plus: "algebraic x \<Longrightarrow> algebraic y \<Longrightarrow> algebraic (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>algebraic x; algebraic y\<rbrakk> \<Longrightarrow> algebraic (x + y)
[PROOF STEP]
by (auto dest!: algebraic_imp_represents_irreducible_cf_pos intro!: algebraic_representsI[OF represents_add])


[STATEMENT]
lemma diameter_singleton [simp]: "diameter{x} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diameter {x} = 0
[PROOF STEP]
by (auto simp: diameter_def)


[STATEMENT]
lemma ereal_ex_split: "\<And>P. (\<exists>x::ereal. P x) \<longleftrightarrow> P \<infinity> \<or> (\<exists>x. P (ereal x)) \<or> P (-\<infinity>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. (\<exists>x. P x) = (P \<infinity> \<or> (\<exists>x. P (ereal x)) \<or> P (- \<infinity>))
[PROOF STEP]
by (metis ereal_cases)


[STATEMENT]
lemma op_closed'[simp]: "\<forall>x\<in>U. \<forall>y\<in>U. x \<oplus>\<^sub>a y \<in> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>U. \<forall>y\<in>U. x \<oplus>\<^sub>a y \<in> U
[PROOF STEP]
by (simp add: op_closed)


[STATEMENT]
lemma prime_factorization_divide:
  assumes "b dvd a"
  shows   "prime_factorization (a div b) = prime_factorization a - prime_factorization b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
 2. a \<noteq> (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
 2. a \<noteq> (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b dvd a
[PROOF STEP]
have [simp]: "b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
b dvd a

goal (1 subgoal):
 1. b \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<noteq> (0::'a)

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
 2. a \<noteq> (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
have "prime_factorization ((a div b) * b) = prime_factorization (a div b) + prime_factorization b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (a div b * b) = prime_factorization (a div b) + prime_factorization b
[PROOF STEP]
by (intro prime_factorization_mult) (insert assms, auto elim!: dvdE)
[PROOF STATE]
proof (state)
this:
prime_factorization (a div b * b) = prime_factorization (a div b) + prime_factorization b

goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
 2. a \<noteq> (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b dvd a
prime_factorization (a div b * b) = prime_factorization (a div b) + prime_factorization b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b dvd a
prime_factorization (a div b * b) = prime_factorization (a div b) + prime_factorization b

goal (1 subgoal):
 1. prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime_factorization (a div b) = prime_factorization a - prime_factorization b

goal (1 subgoal):
 1. a = (0::'a) \<Longrightarrow> prime_factorization (a div b) = prime_factorization a - prime_factorization b
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma interval_integrable_isCont:
  fixes a b and f :: "real \<Rightarrow> 'a::{banach, second_countable_topology}"
  shows "(\<And>x. min a b \<le> x \<Longrightarrow> x \<le> max a b \<Longrightarrow> isCont f x) \<Longrightarrow>
    interval_lebesgue_integrable lborel a b f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x) \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
[PROOF STEP]
proof (induct a b rule: linorder_wlog)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; \<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
 2. \<And>a b. \<lbrakk>(\<And>x. \<lbrakk>min b a \<le> x; x \<le> max b a\<rbrakk> \<Longrightarrow> isCont f x) \<Longrightarrow> interval_lebesgue_integrable lborel (ereal b) (ereal a) f; \<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
[PROOF STEP]
case (le a b)
[PROOF STATE]
proof (state)
this:
a \<le> b
\<lbrakk>min a b \<le> ?x; ?x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f ?x

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; \<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
 2. \<And>a b. \<lbrakk>(\<And>x. \<lbrakk>min b a \<le> x; x \<le> max b a\<rbrakk> \<Longrightarrow> isCont f x) \<Longrightarrow> interval_lebesgue_integrable lborel (ereal b) (ereal a) f; \<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
\<lbrakk>min a b \<le> ?x; ?x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f ?x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<le> b
\<lbrakk>min a b \<le> ?x; ?x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f ?x

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal a) (ereal b) f
[PROOF STEP]
unfolding interval_lebesgue_integrable_def set_integrable_def
[PROOF STATE]
proof (prove)
using this:
a \<le> b
\<lbrakk>min a b \<le> ?x; ?x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f ?x

goal (1 subgoal):
 1. if ereal a \<le> ereal b then integrable lborel (\<lambda>x. indicat_real (einterval (ereal a) (ereal b)) x *\<^sub>R f x) else integrable lborel (\<lambda>x. indicat_real (einterval (ereal b) (ereal a)) x *\<^sub>R f x)
[PROOF STEP]
by (auto simp: interval_lebesgue_integrable_def
        intro!: set_integrable_subset[unfolded set_integrable_def, OF borel_integrable_compact[of "{a .. b}"]]
        continuous_at_imp_continuous_on)
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integrable lborel (ereal a) (ereal b) f

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>(\<And>x. \<lbrakk>min b a \<le> x; x \<le> max b a\<rbrakk> \<Longrightarrow> isCont f x) \<Longrightarrow> interval_lebesgue_integrable lborel (ereal b) (ereal a) f; \<And>x. \<lbrakk>min a b \<le> x; x \<le> max a b\<rbrakk> \<Longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> interval_lebesgue_integrable lborel (ereal a) (ereal b) f
[PROOF STEP]
qed (auto intro: interval_integrable_endpoints_reverse[THEN iffD1])


[STATEMENT]
lemma infnorm_0: "infnorm 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infnorm (0::'a) = 0
[PROOF STEP]
by (simp add: infnorm_eq_0)


[STATEMENT]
lemma real_le_lsqrt: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x \<le> y\<^sup>2 \<Longrightarrow> sqrt x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y; x \<le> y\<^sup>2\<rbrakk> \<Longrightarrow> sqrt x \<le> y
[PROOF STEP]
using real_sqrt_le_iff[of x "y\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
(sqrt x \<le> sqrt (y\<^sup>2)) = (x \<le> y\<^sup>2)

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y; x \<le> y\<^sup>2\<rbrakk> \<Longrightarrow> sqrt x \<le> y
[PROOF STEP]
by simp


[STATEMENT]
lemma hcis_hypreal_of_nat_Suc_mult:
  "\<And>a. hcis (hypreal_of_nat (Suc n) * a) = hcis a * hcis (hypreal_of_nat n * a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. hcis (hypreal_of_nat (Suc n) * a) = hcis a * hcis (hypreal_of_nat n * a)
[PROOF STEP]
by transfer (simp add: distrib_right cis_mult)


[STATEMENT]
lemma affine_alg_set_memI:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "\<And>p. p \<in> B \<Longrightarrow> eval_at_point R a p = \<zero>"
  shows "a \<in> (affine_alg_set R n B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> affine_alg_set R n B
[PROOF STEP]
unfolding affine_alg_set_def zero_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {a \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>B. a \<in> {a \<in> carrier (R\<^bsup>n\<^esup>). eval_at_point R a b = \<zero>}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
?p30 \<in> B \<Longrightarrow> eval_at_point R a ?p30 = \<zero>

goal (1 subgoal):
 1. a \<in> {a \<in> carrier (R\<^bsup>n\<^esup>). \<forall>b\<in>B. a \<in> {a \<in> carrier (R\<^bsup>n\<^esup>). eval_at_point R a b = \<zero>}}
[PROOF STEP]
by blast


[STATEMENT]
lemma lookup_filter: "lookup (filter P xs) k = (let v = lookup xs k in if P (k, v) then v else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (local.filter P xs) k = (let v = lookup xs k in if P (k, v) then v else (0::'b))
[PROOF STEP]
by (simp add: lookup_def lookup_raw_filter_raw oalist_inv_list_of_oalist)


[STATEMENT]
lemma sgn_plus:
  fixes x y :: "'a::linordered_idom"
  assumes "sgn x = sgn y"
  shows "sgn (x + y) = sgn x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (x + y) = sgn x
[PROOF STEP]
by (simp add: assms same_sgn_sgn_add)


[STATEMENT]
lemma size_hp_merge: "size_hp(merge h1 h2) = size_hp h1 + size_hp h2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_hp (merge h1 h2) = size_hp h1 + size_hp h2
[PROOF STEP]
by (induction h1 h2 rule: merge.induct) simp_all


[STATEMENT]
lemma mask_numeral:
  \<open>mask (numeral n) = 1 + 2 * mask (pred_numeral n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mask (numeral n) = (1::'a) + (2::'a) * mask (pred_numeral n)
[PROOF STEP]
by (simp add: numeral_eq_Suc mask_Suc_double one_or_eq ac_simps)


[STATEMENT]
lemma lub_option_least:
  assumes Y: "Complete_Partial_Order.chain (ord_option ord) Y"
  and upper: "\<And>x. x \<in> Y \<Longrightarrow> ord_option ord x y"
  assumes lub_least: "\<And>Y y. \<lbrakk> Complete_Partial_Order.chain ord Y; \<And>x. x \<in> Y \<Longrightarrow> ord x y \<rbrakk> \<Longrightarrow> ord (lub Y) y"
  shows "ord_option ord (lub_option lub Y) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_option ord (lub_option lub Y) y
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
Complete_Partial_Order.chain (ord_option ord) Y

goal (1 subgoal):
 1. ord_option ord (lub_option lub Y) y
[PROOF STEP]
by(cases y)(auto 4 3 simp add: lub_option_def intro: lub_least[OF ord_option_chainD] dest: upper)


[STATEMENT]
lemma destr_contstr_comp_id: "(\<And>v. destr (constr v) = v) \<Longrightarrow> destr \<circ> constr = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v. destr (constr v) = v) \<Longrightarrow> destr \<circ> constr = id
[PROOF STEP]
by (rule ext) simp


[STATEMENT]
lemma closed_translation_subtract:
  "closed ((\<lambda>x. x - a) ` S)" if "closed S" for a :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((\<lambda>x. x - a) ` S)
[PROOF STEP]
using that closed_translation [of S "- a"]
[PROOF STATE]
proof (prove)
using this:
closed S
closed S \<Longrightarrow> closed ((+) (- a) ` S)

goal (1 subgoal):
 1. closed ((\<lambda>x. x - a) ` S)
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma Gromov_hyperbolic_subsetI [intro]:
  assumes "\<And>x y z t. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> z \<in> A \<Longrightarrow> t \<in> A \<Longrightarrow> dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta"
  shows "Gromov_hyperbolic_subset delta A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_hyperbolic_subset delta A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> A; ?y \<in> A; ?z \<in> A; ?t \<in> A\<rbrakk> \<Longrightarrow> dist ?x ?y + dist ?z ?t \<le> max (dist ?x ?z + dist ?y ?t) (dist ?x ?t + dist ?y ?z) + 2 * delta

goal (1 subgoal):
 1. Gromov_hyperbolic_subset delta A
[PROOF STEP]
unfolding Gromov_hyperbolic_subset_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> A; ?y \<in> A; ?z \<in> A; ?t \<in> A\<rbrakk> \<Longrightarrow> dist ?x ?y + dist ?z ?t \<le> max (dist ?x ?z + dist ?y ?t) (dist ?x ?t + dist ?y ?z) + 2 * delta

goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. \<forall>z\<in>A. \<forall>t\<in>A. dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
by auto


[STATEMENT]
lemma between_trans_2:
  fixes a :: "'a :: euclidean_space"
  shows "\<lbrakk>between (b,c) a; between (a,b) d\<rbrakk> \<Longrightarrow> between (c,d) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>between (b, c) a; between (a, b) d\<rbrakk> \<Longrightarrow> between (c, d) a
[PROOF STEP]
by (metis between_commute between_swap between_trans)


[STATEMENT]
lemma is_unit_pCons_iff: "is_unit (pCons a p) \<longleftrightarrow> p = 0 \<and> a \<noteq> 0"
  for p :: "'a::field poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (pCons a p) = (p = 0 \<and> a \<noteq> (0::'a))
[PROOF STEP]
by (cases "p = 0") (auto simp: is_unit_triv is_unit_iff_degree)


[STATEMENT]
lemma support_on_nonneg_sum:
  "support_on X (\<lambda>x. \<Sum>i\<in>S. f i x) = (\<Union>i\<in>S. support_on X (f i))"
  if "finite S" "\<And>x i . x \<in> X \<Longrightarrow> i \<in> S \<Longrightarrow> f i x \<ge> 0"
  for f::"_\<Rightarrow>_\<Rightarrow>_::ordered_comm_monoid_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. support_on X (\<lambda>x. \<Sum>i\<in>S. f i x) = (\<Union>i\<in>S. support_on X (f i))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
finite S
\<lbrakk>?x \<in> X; ?i \<in> S\<rbrakk> \<Longrightarrow> (0::'f) \<le> f ?i ?x

goal (1 subgoal):
 1. support_on X (\<lambda>x. \<Sum>i\<in>S. f i x) = (\<Union>i\<in>S. support_on X (f i))
[PROOF STEP]
by (auto simp: support_on_def sum_nonneg_eq_0_iff)


[STATEMENT]
lemma locally_path_connected_UNIV: "locally path_connected (UNIV::'a :: real_normed_vector set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. locally path_connected UNIV
[PROOF STEP]
by (simp add: open_imp_locally_path_connected)


[STATEMENT]
lemma zero_less_binomial_iff [simp]: "n choose k > 0 \<longleftrightarrow> k \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < n choose k) = (k \<le> n)
[PROOF STEP]
by (metis binomial_eq_0_iff not_less0 not_less zero_less_binomial)


[STATEMENT]
lemma ozero_ordLeq:
assumes "Well_order r"  shows "ozero \<le>o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ozero \<le>o r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Well_order r

goal (1 subgoal):
 1. ozero \<le>o r
[PROOF STEP]
unfolding ozero_def ordLeq_def embed_def[abs_def] under_def
[PROOF STATE]
proof (prove)
using this:
Well_order r

goal (1 subgoal):
 1. ({}, r) \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> (\<exists>f. \<forall>a\<in>Field r. bij_betw f {b. (b, a) \<in> r} {b. (b, f a) \<in> r'})}
[PROOF STEP]
by auto


[STATEMENT]
lemma vreal_transitive_law:
  assumes "x \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "y \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "z \<in>\<^sub>\<circ> \<real>\<^sub>\<circ>"
    and "x <\<^sub>\<real> y" and "y <\<^sub>\<real> z"
  shows "x <\<^sub>\<real> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x <\<^sub>\<real> z
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x <\<^sub>\<real> z
[PROOF STEP]
have "x' < y' \<Longrightarrow> y' < z' \<Longrightarrow> x' < z'" for x' y' z' :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x' < y'; y' < z'\<rbrakk> \<Longrightarrow> x' < z'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x' < ?y'; ?y' < ?z'\<rbrakk> \<Longrightarrow> ?x' < ?z'

goal (1 subgoal):
 1. x <\<^sub>\<real> z
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x <\<^sub>\<real> z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x <\<^sub>\<real> z

goal (1 subgoal):
 1. x <\<^sub>\<real> z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x <\<^sub>\<real> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_nth_eqI:
  fixes xs ys::"'a::monoid_add list"
  shows
    "length xs = length ys \<Longrightarrow> (\<And>x y. (x, y) \<in> set (zip xs ys) \<Longrightarrow> x = y) \<Longrightarrow>
      sum_list xs = sum_list ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length ys; \<And>x y. (x, y) \<in> set (zip xs ys) \<Longrightarrow> x = y\<rbrakk> \<Longrightarrow> sum_list xs = sum_list ys
[PROOF STEP]
by (induct xs ys rule: list_induct2) auto


[STATEMENT]
lemma step_2_similar: "A \<in> carrier_mat n n \<Longrightarrow> similar_mat (step_2 A) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n \<Longrightarrow> similar_mat (step_2 A) A
[PROOF STEP]
unfolding step_2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat n n \<Longrightarrow> similar_mat (step_2_main (dim_row A) 0 A) A
[PROOF STEP]
by (rule step_2_main_similar, auto)


[STATEMENT]
lemma bifunctor_flip_ObjMap_app:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "bifunctor_flip \<AA> \<BB> \<FF>\<lparr>ObjMap\<rparr>\<lparr>b, a\<rparr>\<^sub>\<bullet> = \<FF>\<lparr>ObjMap\<rparr>\<lparr>a, b\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>bifunctor_flip \<AA> \<BB> \<FF>\<^esub> a = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>bifunctor_flip \<AA> \<BB> \<FF>\<^esub> a = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
unfolding bifunctor_flip_components assms(4,5)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
\<FF> : \<AA> \<times>\<^sub>C \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. fflip (\<FF>\<lparr>ObjMap\<rparr>) \<lparr>b, a\<rparr>\<^sub>\<bullet> = a \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<FF>\<^esub> b
[PROOF STEP]
by
    (
      cs_concl cs_shallow
        cs_simp: V_cs_simps cat_cs_simps cs_intro: cat_prod_cs_intros
    )


[STATEMENT]
lemma L5_Boiler:
  assumes h1:"SteamBoiler x s y"
         and h2:"ts x"
         and h3:"hd (x j) = Zero"
  shows "(hd (s j)) \<le> hd (s (Suc j)) + (10::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (s j) \<le> hd (s (Suc j)) + 10
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hd (s j) \<le> hd (s (Suc j)) + 10
[PROOF STEP]
from h1 and h2
[PROOF STATE]
proof (chain)
picking this:
SteamBoiler x s y
ts x
[PROOF STEP]
obtain r where
     a1:"r \<le> 10"  and
     a2:"hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)"
[PROOF STATE]
proof (prove)
using this:
SteamBoiler x s y
ts x

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>r \<le> 10; hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add: SteamBoiler_def, auto)
[PROOF STATE]
proof (state)
this:
r \<le> 10
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)

goal (1 subgoal):
 1. hd (s j) \<le> hd (s (Suc j)) + 10
[PROOF STEP]
from a2 and h3
[PROOF STATE]
proof (chain)
picking this:
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)
hd (x j) = Zero
[PROOF STEP]
have "hd (s (Suc j)) = hd (s j) - r"
[PROOF STATE]
proof (prove)
using this:
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)
hd (x j) = Zero

goal (1 subgoal):
 1. hd (s (Suc j)) = hd (s j) - r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
hd (s (Suc j)) = hd (s j) - r

goal (1 subgoal):
 1. hd (s j) \<le> hd (s (Suc j)) + 10
[PROOF STEP]
from this and a1
[PROOF STATE]
proof (chain)
picking this:
hd (s (Suc j)) = hd (s j) - r
r \<le> 10
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hd (s (Suc j)) = hd (s j) - r
r \<le> 10

goal (1 subgoal):
 1. hd (s j) \<le> hd (s (Suc j)) + 10
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd (s j) \<le> hd (s (Suc j)) + 10

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_UN_well_related:
  assumes XX: "\<forall>X\<in>XX. well_related_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union>XX. \<not>x \<sqsubseteq> y \<longrightarrow> y \<in> X)"
  shows "well_related_set (\<Union>XX) (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_related_set (\<Union> XX) (\<sqsubseteq>)
[PROOF STEP]
using XX
[PROOF STATE]
proof (prove)
using this:
\<forall>X\<in>XX. well_related_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X)

goal (1 subgoal):
 1. well_related_set (\<Union> XX) (\<sqsubseteq>)
[PROOF STEP]
apply (unfold well_related_iff_neg_well_founded)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X\<in>XX. well_founded X (\<lambda>x y. \<not> y \<sqsubseteq> x) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X) \<Longrightarrow> well_founded (\<Union> XX) (\<lambda>x y. \<not> y \<sqsubseteq> x)
[PROOF STEP]
using closed_UN_well_founded[of _ "\<lambda>x y. \<not> y \<sqsubseteq> x"]
[PROOF STATE]
proof (prove)
using this:
\<forall>X\<in>?XX. well_founded X (\<lambda>x y. \<not> y \<sqsubseteq> x) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> ?XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X) \<Longrightarrow> well_founded (\<Union> ?XX) (\<lambda>x y. \<not> y \<sqsubseteq> x)

goal (1 subgoal):
 1. \<forall>X\<in>XX. well_founded X (\<lambda>x y. \<not> y \<sqsubseteq> x) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X) \<Longrightarrow> well_founded (\<Union> XX) (\<lambda>x y. \<not> y \<sqsubseteq> x)
[PROOF STEP]
.


[STATEMENT]
lemma derivs_Plus: "derivs xs (Plus r s) = Plus (derivs xs r) (derivs xs s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. derivs xs (Plus r s) = Plus (derivs xs r) (derivs xs s)
[PROOF STEP]
by (induction xs arbitrary: r s) auto


[STATEMENT]
lemma infdist_eq_setdist: "infdist x A = setdist {x} A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist x A = setdist {x} A
[PROOF STEP]
by (simp add: infdist_def setdist_def Setcompr_eq_image)


[STATEMENT]
lemma hcomp_MkCell [simp]:
    assumes "arr (MkCell B C f)" and "arr (MkCell A B g)"
    shows "hcomp (MkCell B C f) (MkCell A B g) = MkCell A C (Comp C B A f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcomp (MkCell B C f) (MkCell A B g) = MkCell A C (Comp C B A f g)
[PROOF STEP]
by (simp add: assms(1-2) hcomp_def)


[STATEMENT]
lemma asymp_equiv_refl [simp, asymp_equiv_intros]: "f \<sim>[F] f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<sim>[F] f
[PROOF STEP]
proof (intro asymp_equivI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
have "eventually (\<lambda>x. 1 = (if f x = 0 \<and> f x = 0 then 1 else f x / f x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (1::'b) = (if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x)
[PROOF STEP]
by (intro always_eventually) simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. (1::'b) = (if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x)

goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. (1::'b) = (if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x)

goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
have "((\<lambda>_. 1) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>_. 1::'c) \<longlongrightarrow> (1::'c)) F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>_. 1::?'c1) \<longlongrightarrow> (1::?'c1)) F

goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. (1::'b) = (if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x)
((\<lambda>_. 1::?'c1) \<longlongrightarrow> (1::?'c1)) F
[PROOF STEP]
show "((\<lambda>x. if f x = 0 \<and> f x = 0 then 1 else f x / f x) \<longlongrightarrow> 1) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. (1::'b) = (if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x)
((\<lambda>_. 1::?'c1) \<longlongrightarrow> (1::?'c1)) F

goal (1 subgoal):
 1. ((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F
[PROOF STEP]
by (simp add: tendsto_eventually)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if f x = (0::'b) \<and> f x = (0::'b) then 1::'b else f x / f x) \<longlongrightarrow> (1::'b)) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_expansion_aux_exp_neg:
  assumes "is_expansion_aux F f basis" "basis_wf basis" "ms_exp_gt 0 (ms_aux_hd_exp F)"
  shows   "is_expansion_aux (powser_ms_aux' exp_series_stream F) (\<lambda>x. exp (f x)) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_expansion_aux (powser_ms_aux' exp_series_stream F) (\<lambda>x. exp (f x)) basis
[PROOF STEP]
using powser_ms_aux'[OF convergent_powser'_exp assms(2,1,3)]
[PROOF STATE]
proof (prove)
using this:
is_expansion_aux (powser_ms_aux (msllist_of_msstream exp_series_stream) F) (exp \<circ> f) basis

goal (1 subgoal):
 1. is_expansion_aux (powser_ms_aux' exp_series_stream F) (\<lambda>x. exp (f x)) basis
[PROOF STEP]
by (simp add: o_def powser_ms_aux'_def)


[STATEMENT]
lemma arctan_double': "\<bar>a::real\<bar> < 1 \<Longrightarrow> MACHIN_TAG 2 (arctan a) = arctan (2 * a / (1 - a*a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a\<bar> < 1 \<Longrightarrow> MACHIN_TAG 2 (arctan a) = arctan (2 * a / (1 - a * a))
[PROOF STEP]
unfolding MACHIN_TAG_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>a\<bar> < 1 \<Longrightarrow> 2 * arctan a = arctan (2 * a / (1 - a * a))
[PROOF STEP]
by (simp add: arctan_double power2_eq_square)


[STATEMENT]
lemma rQuot_empty[simp]:   "rQuot a {} = {}"
  and rQuot_epsilon[simp]: "rQuot a {[]} = {}"
  and rQuot_char[simp]:    "rQuot a {[b]} = (if a = b then {[]} else {})"
  and rQuot_union[simp]:   "rQuot a (A \<union> B) = rQuot a A \<union> rQuot a B"
  and rQuot_inter[simp]:   "rQuot a (A \<inter> B) = rQuot a A \<inter> rQuot a B"
  and rQuot_compl[simp]:   "rQuot a (-A) = - rQuot a A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rQuot a {} = {} &&& rQuot a {[]} = {} &&& rQuot a {[b]} = (if a = b then {[]} else {})) &&& rQuot a (A \<union> B) = rQuot a A \<union> rQuot a B &&& rQuot a (A \<inter> B) = rQuot a A \<inter> rQuot a B &&& rQuot a (- A) = - rQuot a A
[PROOF STEP]
by (auto simp: rQuot_def)


[STATEMENT]
lemma Qp_funs_mult''':
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "(f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> g) x = f x \<otimes> g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<otimes> g x
[PROOF STEP]
using assms function_ring_def[of "carrier (Q\<^sub>p\<^bsup>n\<^esup>)" "Q\<^sub>p"]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p = \<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = function_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = function_add (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>

goal (1 subgoal):
 1. (f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<otimes> g x
[PROOF STEP]
unfolding function_mult_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p = \<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = \<lambda>f g. \<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = function_add (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>

goal (1 subgoal):
 1. (f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<otimes> g x
[PROOF STEP]
by (metis (mono_tags, lifting) monoid.select_convs(1) restrict_apply')


[STATEMENT]
lemma wf_trmI[intro]:
  assumes "\<And>t. t \<in> set T \<Longrightarrow> wf\<^sub>t\<^sub>r\<^sub>m t" "length T = arity f"
  shows "wf\<^sub>t\<^sub>r\<^sub>m (Fun f T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf\<^sub>t\<^sub>r\<^sub>m (Fun f T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?t2 \<in> set T \<Longrightarrow> wf\<^sub>t\<^sub>r\<^sub>m ?t2
length T = arity f

goal (1 subgoal):
 1. wf\<^sub>t\<^sub>r\<^sub>m (Fun f T)
[PROOF STEP]
unfolding wf\<^sub>t\<^sub>r\<^sub>m_def
[PROOF STATE]
proof (prove)
using this:
?t2 \<in> set T \<Longrightarrow> \<forall>f T. Fun f T \<sqsubseteq> ?t2 \<longrightarrow> length T = arity f
length T = arity f

goal (1 subgoal):
 1. \<forall>fa Ta. Fun fa Ta \<sqsubseteq> Fun f T \<longrightarrow> length Ta = arity fa
[PROOF STEP]
by auto


[STATEMENT]
lemma vec_to_lpoly_valuate_equiv_dot_prod:
  assumes "dim_vec y = dim_vec x"  (* Can be \<ge> *)
  shows "(vec_to_lpoly y) \<lbrace> ($)x \<rbrace> = y \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
let ?p = "vec_to_lpoly y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
have 2: "?p\<lbrace> ($)x \<rbrace> = (\<Sum>j\<in>vars?p. coeff ?p j * x$j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)
[PROOF STEP]
using eval_poly_with_sum[of ?p "($)x"]
[PROOF STATE]
proof (prove)
using this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>xa\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) xa * x $ xa)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
have "vars ?p \<subseteq> {0..<dim_vec y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (vec_to_lpoly y) \<subseteq> {0..<dim_vec y}
[PROOF STEP]
using vars_subset_dim_vec_to_lpoly_dim
[PROOF STATE]
proof (prove)
using this:
vars (vec_to_lpoly ?v) \<subseteq> {0..<dim_vec ?v}

goal (1 subgoal):
 1. vars (vec_to_lpoly y) \<subseteq> {0..<dim_vec y}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vars (vec_to_lpoly y) \<subseteq> {0..<dim_vec y}

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
have 2: "?p\<lbrace> ($)x \<rbrace> = (\<Sum>j\<in>vars?p. coeff ?p j * x$j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)
[PROOF STEP]
using eval_poly_with_sum[of ?p "($)x"]
[PROOF STATE]
proof (prove)
using this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>xa\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) xa * x $ xa)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
have *: "... = (\<Sum>i\<in>{0..<dim_poly ?p}. coeff ?p i * x$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j) = (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i)
[PROOF STEP]
using valuate_with_dim_poly
[PROOF STATE]
proof (prove)
using this:
?z \<lbrace> ?X \<rbrace> = (\<Sum>i = 0..<dim_poly ?z. Abstract_Linear_Poly.coeff ?z i * ?X i)

goal (1 subgoal):
 1. (\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j) = (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i)
[PROOF STEP]
by (metis (no_types, lifting) calculation sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j) = (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>vars (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) j * x $ j) = (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
have "... = y \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x
[PROOF STEP]
have "\<And>j. j < dim_vec x \<Longrightarrow> coeff (vec_to_lpoly y) j = y $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) j = y $ j
[PROOF STEP]
using assms vec_to_lin_poly_coeff_access
[PROOF STATE]
proof (prove)
using this:
dim_vec y = dim_vec x
?x < dim_vec ?y \<Longrightarrow> ?y $ ?x = Abstract_Linear_Poly.coeff (vec_to_lpoly ?y) ?x

goal (1 subgoal):
 1. \<And>j. j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) j = y $ j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) ?j = y $ ?j

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) ?j = y $ ?j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) ?j = y $ ?j

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x
[PROOF STEP]
using vec_to_lpoly_eval_dot_prod[of "y" "($)x"]
[PROOF STATE]
proof (prove)
using this:
?j < dim_vec x \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly y) ?j = y $ ?j
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> vec (dim_vec y) (($) x)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x
[PROOF STEP]
by (metis assms calculation dim_vec index_vec vec_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_poly (vec_to_lpoly y). Abstract_Linear_Poly.coeff (vec_to_lpoly y) i * x $ i) = y \<bullet> x

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>i = 0..<dim_vec x. y $ i * x $ i)

goal (1 subgoal):
 1. vec_to_lpoly y \<lbrace> ($) x \<rbrace> = (\<Sum>i = 0..<dim_vec x. y $ i * x $ i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec_to_lpoly y \<lbrace> ($) x \<rbrace> = y \<bullet> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutation_insert_permutes:
  assumes q: "q permutes {0..<n}"
      and i: "i < Suc n" and j: "j < Suc n"
  shows "permutation_insert i j q permutes {0..<Suc n}" (is "?p permutes ?N")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutation_insert i j q permutes {0..<Suc n}
[PROOF STEP]
using permutation_insert_bij_betw[OF q i j]
[PROOF STATE]
proof (prove)
using this:
bij_betw (permutation_insert i j q) {0..<Suc n} {0..<Suc n}

goal (1 subgoal):
 1. permutation_insert i j q permutes {0..<Suc n}
[PROOF STEP]
proof (rule bij_imp_permutes)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> {0..<Suc n} \<Longrightarrow> permutation_insert i j q x = x
[PROOF STEP]
fix i'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> {0..<Suc n} \<Longrightarrow> permutation_insert i j q x = x
[PROOF STEP]
assume "i' \<notin> ?N"
[PROOF STATE]
proof (state)
this:
i' \<notin> {0..<Suc n}

goal (1 subgoal):
 1. \<And>x. x \<notin> {0..<Suc n} \<Longrightarrow> permutation_insert i j q x = x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i' \<notin> {0..<Suc n}

goal (1 subgoal):
 1. \<And>x. x \<notin> {0..<Suc n} \<Longrightarrow> permutation_insert i j q x = x
[PROOF STEP]
hence "q (i'-1) = i'-1"
[PROOF STATE]
proof (prove)
using this:
i' \<notin> {0..<Suc n}

goal (1 subgoal):
 1. q (i' - 1) = i' - 1
[PROOF STEP]
using permutes_others[OF q]
[PROOF STATE]
proof (prove)
using this:
i' \<notin> {0..<Suc n}
?x \<notin> {0..<n} \<Longrightarrow> q ?x = ?x

goal (1 subgoal):
 1. q (i' - 1) = i' - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q (i' - 1) = i' - 1

goal (1 subgoal):
 1. \<And>x. x \<notin> {0..<Suc n} \<Longrightarrow> permutation_insert i j q x = x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i' \<notin> {0..<Suc n}
q (i' - 1) = i' - 1
[PROOF STEP]
show "?p i' = i'"
[PROOF STATE]
proof (prove)
using this:
i' \<notin> {0..<Suc n}
q (i' - 1) = i' - 1

goal (1 subgoal):
 1. permutation_insert i j q i' = i'
[PROOF STEP]
unfolding permutation_insert_expand
[PROOF STATE]
proof (prove)
using this:
i' \<notin> {0..<Suc n}
q (i' - 1) = i' - 1

goal (1 subgoal):
 1. (if i' < i then if q i' < j then q i' else Suc (q i') else if i' = i then j else if q (i' - 1) < j then q (i' - 1) else Suc (q (i' - 1))) = i'
[PROOF STEP]
using i j
[PROOF STATE]
proof (prove)
using this:
i' \<notin> {0..<Suc n}
q (i' - 1) = i' - 1
i < Suc n
j < Suc n

goal (1 subgoal):
 1. (if i' < i then if q i' < j then q i' else Suc (q i') else if i' = i then j else if q (i' - 1) < j then q (i' - 1) else Suc (q (i' - 1))) = i'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permutation_insert i j q i' = i'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Moebius_function_holomorphic:
  assumes "norm w < 1"
  shows "Moebius_function t w holomorphic_on ball 0 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Moebius_function t w holomorphic_on ball 0 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Moebius_function t w holomorphic_on ball 0 1
[PROOF STEP]
have *: "1 - z * w \<noteq> 0" if "norm z < 1" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - z * w \<noteq> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 - z * w \<noteq> 0
[PROOF STEP]
have "norm (1::complex) \<noteq> norm (z * w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod 1 \<noteq> cmod (z * w)
[PROOF STEP]
using assms that norm_mult_less
[PROOF STATE]
proof (prove)
using this:
cmod w < 1
cmod z < 1
\<lbrakk>norm ?x < ?r; norm ?y < ?s\<rbrakk> \<Longrightarrow> norm (?x * ?y) < ?r * ?s

goal (1 subgoal):
 1. cmod 1 \<noteq> cmod (z * w)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
cmod 1 \<noteq> cmod (z * w)

goal (1 subgoal):
 1. 1 - z * w \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cmod 1 \<noteq> cmod (z * w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod 1 \<noteq> cmod (z * w)

goal (1 subgoal):
 1. 1 - z * w \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 - z * w \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cmod ?z < 1 \<Longrightarrow> 1 - ?z * w \<noteq> 0

goal (1 subgoal):
 1. Moebius_function t w holomorphic_on ball 0 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Moebius_function t w holomorphic_on ball 0 1
[PROOF STEP]
apply (simp add: Moebius_function_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>z. exp (\<i> * complex_of_real t) * (z - w) / (1 - cnj w * z)) holomorphic_on ball 0 1
[PROOF STEP]
apply (intro holomorphic_intros)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z. z \<in> ball 0 1 \<Longrightarrow> 1 - cnj w * z \<noteq> 0
[PROOF STEP]
using assms *
[PROOF STATE]
proof (prove)
using this:
cmod w < 1
cmod ?z < 1 \<Longrightarrow> 1 - ?z * w \<noteq> 0

goal (1 subgoal):
 1. \<And>z. z \<in> ball 0 1 \<Longrightarrow> 1 - cnj w * z \<noteq> 0
[PROOF STEP]
by (metis complex_cnj_cnj complex_cnj_mult complex_cnj_one complex_mod_cnj mem_ball_0 mult.commute right_minus_eq)
[PROOF STATE]
proof (state)
this:
Moebius_function t w holomorphic_on ball 0 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_Mi_eq_card_edge_as_set_Mi:
  assumes "matching V E M"
  shows "card (matching_i i V E M L) = card (edge_as_set` matching_i i V E M L)"
  (is "card ?Mi = card (?f ` _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (matching_i i V E M L) = card (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (matching_i i V E M L) = card (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
matching V E M
[PROOF STEP]
have "bij_betw ?f ?Mi (?f ` ?Mi)"
[PROOF STATE]
proof (prove)
using this:
matching V E M

goal (1 subgoal):
 1. bij_betw edge_as_set (matching_i i V E M L) (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
by (simp add: bij_betw_def matching_i_edges_as_sets edge_as_set_inj_on_Mi)
[PROOF STATE]
proof (state)
this:
bij_betw edge_as_set (matching_i i V E M L) (edge_as_set ` matching_i i V E M L)

goal (1 subgoal):
 1. card (matching_i i V E M L) = card (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw edge_as_set (matching_i i V E M L) (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw edge_as_set (matching_i i V E M L) (edge_as_set ` matching_i i V E M L)

goal (1 subgoal):
 1. card (matching_i i V E M L) = card (edge_as_set ` matching_i i V E M L)
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card (matching_i i V E M L) = card (edge_as_set ` matching_i i V E M L)

goal:
No subgoals!
[PROOF STEP]
qed