[STATEMENT]
lemma prime_elem_dvd_prod_list:
  assumes p: "prime_elem p" and pA: "p dvd prod_list A" shows "\<exists>a \<in> set A. p dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>set A. p dvd a
[PROOF STEP]
proof(insert pA, induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd prod_list [] \<Longrightarrow> Bex (set []) ((dvd) p)
 2. \<And>a A. \<lbrakk>p dvd prod_list A \<Longrightarrow> Bex (set A) ((dvd) p); p dvd prod_list (a # A)\<rbrakk> \<Longrightarrow> Bex (set (a # A)) ((dvd) p)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
p dvd prod_list []

goal (2 subgoals):
 1. p dvd prod_list [] \<Longrightarrow> Bex (set []) ((dvd) p)
 2. \<And>a A. \<lbrakk>p dvd prod_list A \<Longrightarrow> Bex (set A) ((dvd) p); p dvd prod_list (a # A)\<rbrakk> \<Longrightarrow> Bex (set (a # A)) ((dvd) p)
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
p dvd prod_list []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prime_elem p
p dvd prod_list []

goal (1 subgoal):
 1. \<exists>a\<in>set []. p dvd a
[PROOF STEP]
by (simp add: prime_elem_not_unit)
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>set []. p dvd a

goal (1 subgoal):
 1. \<And>a A. \<lbrakk>p dvd prod_list A \<Longrightarrow> Bex (set A) ((dvd) p); p dvd prod_list (a # A)\<rbrakk> \<Longrightarrow> Bex (set (a # A)) ((dvd) p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a A. \<lbrakk>p dvd prod_list A \<Longrightarrow> Bex (set A) ((dvd) p); p dvd prod_list (a # A)\<rbrakk> \<Longrightarrow> Bex (set (a # A)) ((dvd) p)
[PROOF STEP]
case (Cons a A)
[PROOF STATE]
proof (state)
this:
p dvd prod_list A \<Longrightarrow> \<exists>a\<in>set A. p dvd a
p dvd prod_list (a # A)

goal (1 subgoal):
 1. \<And>a A. \<lbrakk>p dvd prod_list A \<Longrightarrow> Bex (set A) ((dvd) p); p dvd prod_list (a # A)\<rbrakk> \<Longrightarrow> Bex (set (a # A)) ((dvd) p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd prod_list A \<Longrightarrow> \<exists>a\<in>set A. p dvd a
p dvd prod_list (a # A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p dvd prod_list A \<Longrightarrow> \<exists>a\<in>set A. p dvd a
p dvd prod_list (a # A)

goal (1 subgoal):
 1. \<exists>a\<in>set (a # A). p dvd a
[PROOF STEP]
by (auto simp: prime_elem_dvd_mult_iff[OF p])
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>set (a # A). p dvd a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_diff_limit_1:
  assumes "(\<lambda>j. cos (\<theta> j - \<Theta>)) \<longlonglongrightarrow> 1"
  obtains k where "(\<lambda>j. \<theta> j - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k where "(\<lambda>j. (\<theta> j - \<Theta>) - of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cos_limit_1 [OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>k. (\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>j. \<Theta> + ((\<theta> j - \<Theta>) - of_int (k j) * (2 * pi))) \<longlonglongrightarrow> \<Theta> + 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. \<theta> j - \<Theta> - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>j. \<Theta> + (\<theta> j - \<Theta> - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> \<Theta> + 0
[PROOF STEP]
by (rule tendsto_add [OF tendsto_const])
[PROOF STATE]
proof (state)
this:
(\<lambda>j. \<Theta> + (\<theta> j - \<Theta> - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> \<Theta> + 0

goal (1 subgoal):
 1. (\<And>k. (\<lambda>j. \<theta> j - real_of_int (k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>j. \<theta> j - real_of_int (?k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis
(\<lambda>j. \<Theta> + (\<theta> j - \<Theta> - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> \<Theta> + 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>j. \<theta> j - real_of_int (?k j) * (2 * pi)) \<longlonglongrightarrow> \<Theta> \<Longrightarrow> thesis
(\<lambda>j. \<Theta> + (\<theta> j - \<Theta> - real_of_int (k j) * (2 * pi))) \<longlonglongrightarrow> \<Theta> + 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_concat':
  "\<lbrakk>distinct [ys\<leftarrow>xs. ys \<noteq> Nil]; \<And>ys. ys \<in> set xs \<Longrightarrow> distinct ys;
   \<And>ys zs. \<lbrakk>ys \<in> set xs; zs \<in> set xs; ys \<noteq> zs\<rbrakk> \<Longrightarrow> set ys \<inter> set zs = {}\<rbrakk>
  \<Longrightarrow> distinct (concat xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (filter (\<lambda>ys. ys \<noteq> []) xs); \<And>ys. ys \<in> set xs \<Longrightarrow> distinct ys; \<And>ys zs. \<lbrakk>ys \<in> set xs; zs \<in> set xs; ys \<noteq> zs\<rbrakk> \<Longrightarrow> set ys \<inter> set zs = {}\<rbrakk> \<Longrightarrow> distinct (concat xs)
[PROOF STEP]
by(erule distinct_concat[of "[ys\<leftarrow>xs. ys \<noteq> Nil]", unfolded concat_filter_neq_Nil]) auto


[STATEMENT]
lemma fps_mult_fps_X_plus_1_nth:
  "((1+fps_X)*a) $n = (if n = 0 then (a$n :: 'a::semiring_1) else a$n + a$(n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
 2. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
 2. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
by (simp add: fps_mult_nth)
[PROOF STATE]
proof (state)
this:
((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
have "((1 + fps_X)*a) $ n = sum (\<lambda>i. (1 + fps_X) $ i * a $ (n - i)) {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((1 + fps_X) * a) $ n = (\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i))
[PROOF STEP]
by (simp add: fps_mult_nth)
[PROOF STATE]
proof (state)
this:
((1 + fps_X) * a) $ n = (\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((1 + fps_X) * a) $ n = (\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
have "\<dots> = sum (\<lambda>i. (1+fps_X)$i * a$(n-i)) {0.. 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i)) = (\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (n - i))
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..Suc m. (1 + fps_X) $ i * a $ (Suc m - i)) = (\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (Suc m - i))
[PROOF STEP]
by (rule sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i)) = (\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (n - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (1 + fps_X) $ i * a $ (n - i)) = (\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (n - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
have "\<dots> = (if n = 0 then a$n else a$n + a$(n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (n - i)) = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..1. (1 + fps_X) $ i * a $ (n - i)) = (if n = 0 then a $ n else a $ n + a $ (n - 1))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))

goal (1 subgoal):
 1. ((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((1 + fps_X) * a) $ n = (if n = 0 then a $ n else a $ n + a $ (n - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_vec_vCons_lt:
  assumes "\<And> i. i < dim_vec (vCons a v) \<Longrightarrow> (vCons a v) $ i \<le> (n ::int)"
  assumes "sum_vec v \<le> m"
  shows "sum_vec (vCons a v) \<le> n + m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
have split: "sum_vec (vCons a v) = a + sum_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
by (simp add: sum_vec_vCons)
[PROOF STATE]
proof (state)
this:
sum_vec (vCons a v) = a + sum_vec v

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
have a: "(vCons a v) $ 0 = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vCons a v $ 0 = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vCons a v $ 0 = a

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vCons a v $ 0 = a
[PROOF STEP]
have "0 < dim_vec (vCons a v)"
[PROOF STATE]
proof (prove)
using this:
vCons a v $ 0 = a

goal (1 subgoal):
 1. 0 < dim_vec (vCons a v)
[PROOF STEP]
using dim_vec_vCons_ne_0
[PROOF STATE]
proof (prove)
using this:
vCons a v $ 0 = a
0 < dim_vec (vCons ?a ?v)

goal (1 subgoal):
 1. 0 < dim_vec (vCons a v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < dim_vec (vCons a v)

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < dim_vec (vCons a v)
[PROOF STEP]
have "a \<le> n"
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec (vCons a v)

goal (1 subgoal):
 1. a \<le> n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec (vCons a v)
?i < dim_vec (vCons a v) \<Longrightarrow> vCons a v $ ?i \<le> n
sum_vec v \<le> m

goal (1 subgoal):
 1. a \<le> n
[PROOF STEP]
by (metis a)
[PROOF STATE]
proof (state)
this:
a \<le> n

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<le> n

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
using split assms
[PROOF STATE]
proof (prove)
using this:
a \<le> n
sum_vec (vCons a v) = a + sum_vec v
?i < dim_vec (vCons a v) \<Longrightarrow> vCons a v $ ?i \<le> n
sum_vec v \<le> m

goal (1 subgoal):
 1. sum_vec (vCons a v) \<le> n + m
[PROOF STEP]
by (simp add: add_mono)
[PROOF STATE]
proof (state)
this:
sum_vec (vCons a v) \<le> n + m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rk_couple :
  assumes "A \<noteq> B"
  shows "rk {A, B} = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B} = 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {A, B} = 2
[PROOF STEP]
have f1:"rk {A, B} \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B} \<le> 2
[PROOF STEP]
by (metis insert_is_Un matroid_ax_2_alt one_add_one rk_singleton)
[PROOF STATE]
proof (state)
this:
rk {A, B} \<le> 2

goal (1 subgoal):
 1. rk {A, B} = 2
[PROOF STEP]
have f2:"rk {A, B} \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> rk {A, B}
[PROOF STEP]
by (simp add: assms rk_ax_couple)
[PROOF STATE]
proof (state)
this:
2 \<le> rk {A, B}

goal (1 subgoal):
 1. rk {A, B} = 2
[PROOF STEP]
from f1 and f2
[PROOF STATE]
proof (chain)
picking this:
rk {A, B} \<le> 2
2 \<le> rk {A, B}
[PROOF STEP]
show "?thesis"
[PROOF STATE]
proof (prove)
using this:
rk {A, B} \<le> 2
2 \<le> rk {A, B}

goal (1 subgoal):
 1. rk {A, B} = 2
[PROOF STEP]
by (simp add: f1 le_antisym)
[PROOF STATE]
proof (state)
this:
rk {A, B} = 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Mf_Mf[simp]: "Mf (Mf x) = Mf x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mf (Mf x) = Mf x
[PROOF STEP]
proof (cases x, auto simp: Mf_def, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. x = (a, b) \<Longrightarrow> image_mset Mp (image_mset Mp b) = image_mset Mp b
[PROOF STEP]
case (1 c fs)
[PROOF STATE]
proof (state)
this:
x = (c, fs)

goal (1 subgoal):
 1. \<And>a b. x = (a, b) \<Longrightarrow> image_mset Mp (image_mset Mp b) = image_mset Mp b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset Mp (image_mset Mp fs) = image_mset Mp fs
[PROOF STEP]
by (induct fs, auto)
[PROOF STATE]
proof (state)
this:
image_mset Mp (image_mset Mp fs) = image_mset Mp fs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normalize_smult:
  fixes c :: "'a :: {normalization_semidom_multiplicative, idom_divide}"
  shows "normalize (smult c p) = smult (normalize c) (normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
have "smult c p = [:c:] * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult c p = [:c:] * p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult c p = [:c:] * p

goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult c p = [:c:] * p

goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
have "normalize \<dots> = smult (normalize c) (normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize ([:c:] * p) = smult (normalize c) (normalize p)
[PROOF STEP]
by (subst normalize_mult) (simp add: normalize_const_poly)
[PROOF STATE]
proof (state)
this:
normalize ([:c:] * p) = smult (normalize c) (normalize p)

goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize (smult c p) = smult (normalize c) (normalize p)

goal (1 subgoal):
 1. normalize (smult c p) = smult (normalize c) (normalize p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
normalize (smult c p) = smult (normalize c) (normalize p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graph_homomorphism_on_graph:
  assumes "graph_homomorphism A B R"
  shows "graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
graph_homomorphism A B R
[PROOF STEP]
have "Range R \<subseteq> vertices B"
    and ep: "edge_preserving R (edges A) (edges B)"
[PROOF STATE]
proof (prove)
using this:
graph_homomorphism A B R

goal (1 subgoal):
 1. Range R \<subseteq> vertices B &&& edge_preserving R (edges A) (edges B)
[PROOF STEP]
unfolding graph_homomorphism_def
[PROOF STATE]
proof (prove)
using this:
vertices A = Domain R \<and> graph A \<and> graph B \<and> R `` vertices A \<subseteq> vertices B \<and> univalent R \<and> edge_preserving R (edges A) (edges B)

goal (1 subgoal):
 1. Range R \<subseteq> vertices B &&& edge_preserving R (edges A) (edges B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Range R \<subseteq> vertices B
edge_preserving R (edges A) (edges B)

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
hence d:"Domain R \<subseteq> Domain (R O on_graph B f)"
[PROOF STATE]
proof (prove)
using this:
Range R \<subseteq> vertices B
edge_preserving R (edges A) (edges B)

goal (1 subgoal):
 1. Domain R \<subseteq> Domain (R O on_graph B f)
[PROOF STEP]
unfolding Domain_id_on
[PROOF STATE]
proof (prove)
using this:
Range R \<subseteq> vertices B
edge_preserving R (edges A) (edges B)

goal (1 subgoal):
 1. Domain R \<subseteq> Domain R \<inter> R\<inverse> `` Domain (on_graph B f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Domain R \<subseteq> Domain (R O on_graph B f)

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
have v:"vertices (map_graph (R O on_graph B f) A) \<subseteq> vertices (map_graph_fn B f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertices (map_graph (R O on_graph B f) A) \<subseteq> vertices (map_graph_fn B f)
[PROOF STEP]
unfolding BNF_Def.Gr_def map_graph_selectors
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (R O {(a, f a) |a. a \<in> vertices B}) `` vertices A \<subseteq> {(a, f a) |a. a \<in> vertices B} `` vertices B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vertices (map_graph (R O on_graph B f) A) \<subseteq> vertices (map_graph_fn B f)

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
have e:"edges (map_graph (R O on_graph B f) A) \<subseteq> edges (map_graph_fn B f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edges (map_graph (R O on_graph B f) A) \<subseteq> edges (map_graph_fn B f)
[PROOF STEP]
using ep
[PROOF STATE]
proof (prove)
using this:
edge_preserving R (edges A) (edges B)

goal (1 subgoal):
 1. edges (map_graph (R O on_graph B f) A) \<subseteq> edges (map_graph_fn B f)
[PROOF STEP]
unfolding BNF_Def.Gr_def map_graph_selectors edge_preserving
[PROOF STATE]
proof (prove)
using this:
on_triple R `` edges A \<subseteq> edges B

goal (1 subgoal):
 1. on_triple (R O {(a, f a) |a. a \<in> vertices B}) `` edges A \<subseteq> on_triple {(a, f a) |a. a \<in> vertices B} `` edges B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
edges (map_graph (R O on_graph B f) A) \<subseteq> edges (map_graph_fn B f)

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
have u:"graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f
[PROOF STEP]
using e v graph_unionI
[PROOF STATE]
proof (prove)
using this:
edges (map_graph (R O on_graph B f) A) \<subseteq> edges (map_graph_fn B f)
vertices (map_graph (R O on_graph B f) A) \<subseteq> vertices (map_graph_fn B f)
\<lbrakk>edges ?G\<^sub>1 \<subseteq> edges ?G\<^sub>2; vertices ?G\<^sub>1 \<subseteq> vertices ?G\<^sub>2\<rbrakk> \<Longrightarrow> graph_union ?G\<^sub>1 ?G\<^sub>2 = ?G\<^sub>2

goal (1 subgoal):
 1. graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
from d assms u
[PROOF STATE]
proof (chain)
picking this:
Domain R \<subseteq> Domain (R O on_graph B f)
graph_homomorphism A B R
graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f
[PROOF STEP]
show "graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)"
[PROOF STATE]
proof (prove)
using this:
Domain R \<subseteq> Domain (R O on_graph B f)
graph_homomorphism A B R
graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f

goal (1 subgoal):
 1. graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)
[PROOF STEP]
unfolding graph_homomorphism_def2
[PROOF STATE]
proof (prove)
using this:
Domain R \<subseteq> Domain (R O on_graph B f)
vertices A = Domain R \<and> univalent R \<and> graph A \<and> graph B \<and> graph_union (map_graph R A) B = B
graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f

goal (1 subgoal):
 1. vertices A = Domain (R O on_graph B f) \<and> univalent (R O on_graph B f) \<and> graph A \<and> graph (map_graph_fn B f) \<and> graph_union (map_graph (R O on_graph B f) A) (map_graph_fn B f) = map_graph_fn B f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
graph_homomorphism A (map_graph_fn B f) (R O on_graph B f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_real_derivative_deriv_sqrt:
  assumes "x > 0"
  shows "(deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
have "((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
using assms has_real_derivative_inverse_sqrt
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < ?x \<Longrightarrow> ((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - (inverse (sqrt ?x ^ 3) / 4)) (at ?x)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
fix xa :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
assume "xa \<in> {0<..}"
[PROOF STATE]
proof (state)
this:
xa \<in> {0<..}

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xa \<in> {0<..}
[PROOF STEP]
have "inverse (sqrt xa) / 2 = deriv sqrt xa"
[PROOF STATE]
proof (prove)
using this:
xa \<in> {0<..}

goal (1 subgoal):
 1. inverse (sqrt xa) / 2 = deriv sqrt xa
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (sqrt xa) / 2 = deriv sqrt xa

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?xa2 \<in> {0<..} \<Longrightarrow> inverse (sqrt ?xa2) / 2 = deriv sqrt ?xa2

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
?xa2 \<in> {0<..} \<Longrightarrow> inverse (sqrt ?xa2) / 2 = deriv sqrt ?xa2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
?xa2 \<in> {0<..} \<Longrightarrow> inverse (sqrt ?xa2) / 2 = deriv sqrt ?xa2

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
using has_field_derivative_transform_within_open [where S="{0 <..}" and f="(\<lambda>x. inverse (sqrt x) / 2)"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
?xa2 \<in> {0<..} \<Longrightarrow> inverse (sqrt ?xa2) / 2 = deriv sqrt ?xa2
\<lbrakk>((\<lambda>x. inverse (sqrt x) / 2) has_real_derivative ?f') (at ?a); open {0<..}; ?a \<in> {0<..}; \<And>x. x \<in> {0<..} \<Longrightarrow> inverse (sqrt x) / 2 = ?g x\<rbrakk> \<Longrightarrow> (?g has_real_derivative ?f') (at ?a)

goal (1 subgoal):
 1. (deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)
[PROOF STEP]
by (meson assms greaterThan_iff open_greaterThan)
[PROOF STATE]
proof (state)
this:
(deriv sqrt has_real_derivative - inverse (sqrt x ^ 3) / 4) (at x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_by_eqI:
  assumes
    fin: "finite A"
    and "\<And>y. y \<in> A \<Longrightarrow> cmp_f y \<le> cmp_f x"
    and in_X: "x \<in> A"
    and inj: "inj_on cmp_f A"
  shows "Max_by cmp_f A = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
have in_M: "Max_by cmp_f A \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_by cmp_f A \<in> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
?y \<in> A \<Longrightarrow> cmp_f ?y \<le> cmp_f x
x \<in> A
inj_on cmp_f A

goal (1 subgoal):
 1. Max_by cmp_f A \<in> A
[PROOF STEP]
by(auto intro!: Max_by_in)
[PROOF STATE]
proof (state)
this:
Max_by cmp_f A \<in> A

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
hence "cmp_f (Max_by cmp_f A) \<le> cmp_f x"
[PROOF STATE]
proof (prove)
using this:
Max_by cmp_f A \<in> A

goal (1 subgoal):
 1. cmp_f (Max_by cmp_f A) \<le> cmp_f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Max_by cmp_f A \<in> A
finite A
?y \<in> A \<Longrightarrow> cmp_f ?y \<le> cmp_f x
x \<in> A
inj_on cmp_f A

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

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmp_f (Max_by cmp_f A) \<le> cmp_f x

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
have "cmp_f x \<le> cmp_f (Max_by cmp_f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmp_f x \<le> cmp_f (Max_by cmp_f A)
[PROOF STEP]
by (intro Max_by_ge assms)
[PROOF STATE]
proof (state)
this:
cmp_f x \<le> cmp_f (Max_by cmp_f A)

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmp_f (Max_by cmp_f A) = cmp_f x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmp_f (Max_by cmp_f A) = cmp_f x

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
using inj in_M in_X
[PROOF STATE]
proof (prove)
using this:
cmp_f (Max_by cmp_f A) = cmp_f x
inj_on cmp_f A
Max_by cmp_f A \<in> A
x \<in> A

goal (1 subgoal):
 1. Max_by cmp_f A = x
[PROOF STEP]
by(auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
Max_by cmp_f A = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isOK_forallM_index [simp]:
  "isOK (forallM_index P xs) \<longleftrightarrow> (\<forall>i < length xs. isOK (P (xs ! i) i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isOK (forallM_index P xs) = (\<forall>i<length xs. isOK (P (xs ! i) i))
[PROOF STEP]
unfolding forallM_index_def isOK_forallM_index_aux
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length xs. isOK (P (xs ! i) (i + 0))) = (\<forall>i<length xs. isOK (P (xs ! i) i))
[PROOF STEP]
by simp


[STATEMENT]
lemma tllist_case_mono [partial_function_mono, cont_intro]:
  assumes tnil: "\<And>b. monotone orda ordb (\<lambda>f. tnil f b)"
  and tcons: "\<And>x xs. monotone orda ordb (\<lambda>f. tcons f x xs)"
  shows "monotone orda ordb (\<lambda>f. case_tllist (tnil f) (tcons f) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone orda ordb (\<lambda>f. case xs of TNil x \<Rightarrow> tnil f x | TCons x xa \<Rightarrow> tcons f x xa)
[PROOF STEP]
by(rule monotoneI)(auto split: tllist.split dest: monotoneD[OF tnil] monotoneD[OF tcons])


[STATEMENT]
lemma gauss_cnj_0 [simp]: "gauss_cnj 0 = 0"
  and gauss_cnj_1 [simp]: "gauss_cnj 1 = 1"
  and gauss_cnj_cnj [simp]: "gauss_cnj (gauss_cnj z) = z"
  and gauss_cnj_uminus [simp]: "gauss_cnj (-a) = -gauss_cnj a"
  and gauss_cnj_add [simp]: "gauss_cnj (a + b) = gauss_cnj a + gauss_cnj b"
  and gauss_cnj_diff [simp]: "gauss_cnj (a - b) = gauss_cnj a - gauss_cnj b"
  and gauss_cnj_mult [simp]: "gauss_cnj (a * b) = gauss_cnj a * gauss_cnj b"
  and gauss_cnj_of_nat [simp]: "gauss_cnj (of_nat n1) = of_nat n1"
  and gauss_cnj_of_int [simp]: "gauss_cnj (of_int n2) = of_int n2"
  and gauss_cnj_numeral [simp]: "gauss_cnj (numeral n3) = numeral n3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((gauss_cnj 0 = 0 &&& gauss_cnj 1 = 1) &&& gauss_cnj (gauss_cnj z) = z &&& gauss_cnj (- a) = - gauss_cnj a &&& gauss_cnj (a + b) = gauss_cnj a + gauss_cnj b) &&& (gauss_cnj (a - b) = gauss_cnj a - gauss_cnj b &&& gauss_cnj (a * b) = gauss_cnj a * gauss_cnj b) &&& gauss_cnj (of_nat n1) = of_nat n1 &&& gauss_cnj (of_int n2) = of_int n2 &&& gauss_cnj (numeral n3) = numeral n3
[PROOF STEP]
by (simp_all add: gauss_int_eq_iff)


[STATEMENT]
lemma projector_positive:
  assumes "projector M"
  shows "Complex_Matrix.positive M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.positive M
[PROOF STEP]
proof (rule positive_if_decomp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M \<in> carrier_mat ?n ?n
 2. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
show "M \<in> carrier_mat (dim_row M) (dim_row M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<in> carrier_mat (dim_row M) (dim_row M)
[PROOF STEP]
using assms projector_hermitian hermitian_square
[PROOF STATE]
proof (prove)
using this:
projector M
projector ?M \<Longrightarrow> hermitian ?M
hermitian ?M \<Longrightarrow> ?M \<in> carrier_mat (dim_row ?M) (dim_row ?M)

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

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
have "M = Complex_Matrix.adjoint M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = Complex_Matrix.adjoint M
[PROOF STEP]
using assms projector_hermitian[of M]
[PROOF STATE]
proof (prove)
using this:
projector M
projector M \<Longrightarrow> hermitian M

goal (1 subgoal):
 1. M = Complex_Matrix.adjoint M
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
using this:
projector M
projector M \<Longrightarrow> Complex_Matrix.adjoint M = M

goal (1 subgoal):
 1. M = Complex_Matrix.adjoint M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M = Complex_Matrix.adjoint M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
hence "M * Complex_Matrix.adjoint M = M * M"
[PROOF STATE]
proof (prove)
using this:
M = Complex_Matrix.adjoint M

goal (1 subgoal):
 1. M * Complex_Matrix.adjoint M = M * M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M * Complex_Matrix.adjoint M = M * M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M * Complex_Matrix.adjoint M = M * M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
have "... = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * M = M
[PROOF STEP]
using assms projector_square_eq
[PROOF STATE]
proof (prove)
using this:
projector M
projector ?M \<Longrightarrow> ?M * ?M = ?M

goal (1 subgoal):
 1. M * M = M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M * M = M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M * Complex_Matrix.adjoint M = M
[PROOF STEP]
have "M * Complex_Matrix.adjoint M = M"
[PROOF STATE]
proof (prove)
using this:
M * Complex_Matrix.adjoint M = M

goal (1 subgoal):
 1. M * Complex_Matrix.adjoint M = M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
M * Complex_Matrix.adjoint M = M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
thus "\<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M"
[PROOF STATE]
proof (prove)
using this:
M * Complex_Matrix.adjoint M = M

goal (1 subgoal):
 1. \<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>Ma. Ma * Complex_Matrix.adjoint Ma = M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_mult_left_right_inverse:
  fixes A :: "'a::comm_ring_1 mat"
  assumes A: "A \<in> carrier_mat n n"
    and B: "B \<in> carrier_mat n n" and AB: "A * B = 1\<^sub>m n"
  shows "B * A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
have "Determinant.det (A * B) = Determinant.det (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (1\<^sub>m n)
[PROOF STEP]
using AB
[PROOF STATE]
proof (prove)
using this:
A * B = 1\<^sub>m n

goal (1 subgoal):
 1. Determinant.det (A * B) = Determinant.det (1\<^sub>m n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Determinant.det (A * B) = Determinant.det (1\<^sub>m n)

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
hence "Determinant.det A * Determinant.det B = 1"
[PROOF STATE]
proof (prove)
using this:
Determinant.det (A * B) = Determinant.det (1\<^sub>m n)

goal (1 subgoal):
 1. Determinant.det A * Determinant.det B = (1::'a)
[PROOF STEP]
using Determinant.det_mult[OF A B] det_one
[PROOF STATE]
proof (prove)
using this:
Determinant.det (A * B) = Determinant.det (1\<^sub>m n)
Determinant.det (A * B) = Determinant.det A * Determinant.det B
Determinant.det (1\<^sub>m ?n) = (1::?'a)

goal (1 subgoal):
 1. Determinant.det A * Determinant.det B = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Determinant.det A * Determinant.det B = (1::'a)

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
hence det_A: "(Determinant.det A) dvd 1" and det_B: "(Determinant.det B) dvd 1"
[PROOF STATE]
proof (prove)
using this:
Determinant.det A * Determinant.det B = (1::'a)

goal (1 subgoal):
 1. Determinant.det A dvd (1::'a) &&& Determinant.det B dvd (1::'a)
[PROOF STEP]
using dvd_triv_left dvd_triv_right
[PROOF STATE]
proof (prove)
using this:
Determinant.det A * Determinant.det B = (1::'a)
?a dvd ?a * ?b
?a dvd ?b * ?a

goal (1 subgoal):
 1. Determinant.det A dvd (1::'a) &&& Determinant.det B dvd (1::'a)
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
Determinant.det A dvd (1::'a)
Determinant.det B dvd (1::'a)

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
hence inv_A: "invertible_mat A" and inv_B: "invertible_mat B"
[PROOF STATE]
proof (prove)
using this:
Determinant.det A dvd (1::'a)
Determinant.det B dvd (1::'a)

goal (1 subgoal):
 1. invertible_mat A &&& invertible_mat B
[PROOF STEP]
using A B invertible_iff_is_unit_JNF
[PROOF STATE]
proof (prove)
using this:
Determinant.det A dvd (1::'a)
Determinant.det B dvd (1::'a)
A \<in> carrier_mat n n
B \<in> carrier_mat n n
?A \<in> carrier_mat ?n ?n \<Longrightarrow> invertible_mat ?A = (Determinant.det ?A dvd (1::?'a))

goal (1 subgoal):
 1. invertible_mat A &&& invertible_mat B
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
invertible_mat A
invertible_mat B

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
obtain B' where inv_BB': "inverts_mat B B'" and inv_B'B: "inverts_mat B' B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>inverts_mat B B'; inverts_mat B' B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inv_B
[PROOF STATE]
proof (prove)
using this:
invertible_mat B

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>inverts_mat B B'; inverts_mat B' B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding invertible_mat_def
[PROOF STATE]
proof (prove)
using this:
square_mat B \<and> (\<exists>Ba. inverts_mat B Ba \<and> inverts_mat Ba B)

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>inverts_mat B B'; inverts_mat B' B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverts_mat B B'
inverts_mat B' B

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
have B'_carrier: "B' \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B' \<in> carrier_mat n n
[PROOF STEP]
by (metis B inv_B'B inv_BB' carrier_matD(1) carrier_matD(2) carrier_mat_triv
        index_mult_mat(3) index_one_mat(3) inverts_mat_def)
[PROOF STATE]
proof (state)
this:
B' \<in> carrier_mat n n

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
have "B * A * B = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B * A * B = B
[PROOF STEP]
using A AB B
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
A * B = 1\<^sub>m n
B \<in> carrier_mat n n

goal (1 subgoal):
 1. B * A * B = B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B * A * B = B

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
hence "B * A * (B * B') = B * B'"
[PROOF STATE]
proof (prove)
using this:
B * A * B = B

goal (1 subgoal):
 1. B * A * (B * B') = B * B'
[PROOF STEP]
by (smt A AB B B'_carrier assoc_mult_mat carrier_matD(1) inv_BB' inverts_mat_def one_carrier_mat)
[PROOF STATE]
proof (state)
this:
B * A * (B * B') = B * B'

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
B * A * (B * B') = B * B'

goal (1 subgoal):
 1. B * A = 1\<^sub>m n
[PROOF STEP]
by (metis A B carrier_matD(1) carrier_matD(2) index_mult_mat(3) inv_BB'
        inverts_mat_def right_mult_one_mat')
[PROOF STATE]
proof (state)
this:
B * A = 1\<^sub>m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pick_same:
  "l < length xs \<Longrightarrow> Random.pick (map (Pair 1) xs) (natural_of_nat l) = nth xs l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l
[PROOF STEP]
proof (induct xs arbitrary: l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l. l < length [] \<Longrightarrow> pick (map (Pair 1) []) (natural_of_nat l) = [] ! l
 2. \<And>a xs l. \<lbrakk>\<And>l. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l; l < length (a # xs)\<rbrakk> \<Longrightarrow> pick (map (Pair 1) (a # xs)) (natural_of_nat l) = (a # xs) ! l
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
l < length []

goal (2 subgoals):
 1. \<And>l. l < length [] \<Longrightarrow> pick (map (Pair 1) []) (natural_of_nat l) = [] ! l
 2. \<And>a xs l. \<lbrakk>\<And>l. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l; l < length (a # xs)\<rbrakk> \<Longrightarrow> pick (map (Pair 1) (a # xs)) (natural_of_nat l) = (a # xs) ! l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l < length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
l < length []

goal (1 subgoal):
 1. pick (map (Pair 1) []) (natural_of_nat l) = [] ! l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pick (map (Pair 1) []) (natural_of_nat l) = [] ! l

goal (1 subgoal):
 1. \<And>a xs l. \<lbrakk>\<And>l. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l; l < length (a # xs)\<rbrakk> \<Longrightarrow> pick (map (Pair 1) (a # xs)) (natural_of_nat l) = (a # xs) ! l
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs l. \<lbrakk>\<And>l. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l; l < length (a # xs)\<rbrakk> \<Longrightarrow> pick (map (Pair 1) (a # xs)) (natural_of_nat l) = (a # xs) ! l
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
?l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat ?l) = xs ! ?l
l < length (x # xs)

goal (1 subgoal):
 1. \<And>a xs l. \<lbrakk>\<And>l. l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat l) = xs ! l; l < length (a # xs)\<rbrakk> \<Longrightarrow> pick (map (Pair 1) (a # xs)) (natural_of_nat l) = (a # xs) ! l
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat ?l) = xs ! ?l
l < length (x # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?l < length xs \<Longrightarrow> pick (map (Pair 1) xs) (natural_of_nat ?l) = xs ! ?l
l < length (x # xs)

goal (1 subgoal):
 1. pick (map (Pair 1) (x # xs)) (natural_of_nat l) = (x # xs) ! l
[PROOF STEP]
by (cases l) (simp_all add: less_natural_def)
[PROOF STATE]
proof (state)
this:
pick (map (Pair 1) (x # xs)) (natural_of_nat l) = (x # xs) ! l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_not_invertible:
  "\<not> (invertible (0::real^'n^'n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> invertible 0
[PROOF STEP]
using invertible_times_eq_zero matrix_vector_mult_0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invertible ?A; ?A *v ?x = 0\<rbrakk> \<Longrightarrow> ?x = 0
0 *v ?w = 0

goal (1 subgoal):
 1. \<not> invertible 0
[PROOF STEP]
by blast


[STATEMENT]
lemma IdTr2:"Group F \<Longrightarrow> gbij\<^bsub>F,F\<^esub> (I\<^bsub>F\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group F \<Longrightarrow> gbij\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (simp add:gbijec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group F \<Longrightarrow> gsurj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub> \<and> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Group F \<Longrightarrow> gsurj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
 2. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
(* gsurjec *)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Group F \<Longrightarrow> gsurj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
 2. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (simp add:gsurjec_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Group F \<Longrightarrow> I\<^bsub>F\<^esub> \<in> gHom F F \<and> surj_to I\<^bsub>F\<^esub> (carrier F) (carrier F)
 2. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. Group F \<Longrightarrow> I\<^bsub>F\<^esub> \<in> gHom F F
 2. Group F \<Longrightarrow> surj_to I\<^bsub>F\<^esub> (carrier F) (carrier F)
 3. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (simp add:idmap_def gHom_def Group.mult_closed)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Group F \<Longrightarrow> surj_to I\<^bsub>F\<^esub> (carrier F) (carrier F)
 2. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (simp add:surj_to_def image_def idmap_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
(* ginjec *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group F \<Longrightarrow> ginj\<^bsub>F,F\<^esub> I\<^bsub>F\<^esub>
[PROOF STEP]
apply (simp add:ginjec_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group F \<Longrightarrow> I\<^bsub>F\<^esub> \<in> gHom F F \<and> inj_on I\<^bsub>F\<^esub> (carrier F)
[PROOF STEP]
apply (simp add:idmap_def gHom_def Group.mult_closed)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eccentricity_gt_shortest_path:
  assumes "u \<in> V"
  shows "eccentricity v \<ge> shortest_path v u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shortest_path v u \<le> eccentricity v
[PROOF STEP]
proof (cases "u \<in> V - {v}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
 2. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u \<in> V - {v}

goal (2 subgoals):
 1. u \<in> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
 2. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> V - {v}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<in> V - {v}

goal (1 subgoal):
 1. shortest_path v u \<le> eccentricity v
[PROOF STEP]
unfolding eccentricity_def
[PROOF STATE]
proof (prove)
using this:
u \<in> V - {v}

goal (1 subgoal):
 1. shortest_path v u \<le> Sup (shortest_path v ` (V - {v}))
[PROOF STEP]
by (simp add: SUP_upper)
[PROOF STATE]
proof (state)
this:
shortest_path v u \<le> eccentricity v

goal (1 subgoal):
 1. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
case f1: False
[PROOF STATE]
proof (state)
this:
u \<notin> V - {v}

goal (1 subgoal):
 1. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<notin> V - {v}
[PROOF STEP]
have "u = v"
[PROOF STATE]
proof (prove)
using this:
u \<notin> V - {v}

goal (1 subgoal):
 1. u = v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<notin> V - {v}
u \<in> V

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

goal (1 subgoal):
 1. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u = v
[PROOF STEP]
have "shortest_path u v = 0"
[PROOF STATE]
proof (prove)
using this:
u = v

goal (1 subgoal):
 1. shortest_path u v = 0
[PROOF STEP]
using shortest_path_self assms
[PROOF STATE]
proof (prove)
using this:
u = v
?u \<in> V \<Longrightarrow> shortest_path ?u ?u = 0
u \<in> V

goal (1 subgoal):
 1. shortest_path u v = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
shortest_path u v = 0

goal (1 subgoal):
 1. u \<notin> V - {v} \<Longrightarrow> shortest_path v u \<le> eccentricity v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
shortest_path u v = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
shortest_path u v = 0

goal (1 subgoal):
 1. shortest_path v u \<le> eccentricity v
[PROOF STEP]
by (simp add: \<open>u = v\<close>)
[PROOF STATE]
proof (state)
this:
shortest_path v u \<le> eccentricity v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_part_meas_nul_pos_set :
  assumes "pos_meas_set M1"
    and "neg_meas_set M2"
    and "m2 = (\<lambda>A. -\<mu> (A \<inter> M2))"
    and "E \<in> sets M"
    and "E \<subseteq> M1"
  shows "m2 E = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
have "m2 E \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> m2 E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pos_meas_set M1
neg_meas_set M2
m2 = (\<lambda>A. - \<mu> (A \<inter> M2))
E \<in> sets M
E \<subseteq> M1

goal (1 subgoal):
 1. 0 \<le> m2 E
[PROOF STEP]
unfolding neg_meas_set_def
[PROOF STATE]
proof (prove)
using this:
pos_meas_set M1
M2 \<in> sets M \<and> (\<forall>A\<in>sets M. A \<subseteq> M2 \<longrightarrow> \<mu> A \<le> 0)
m2 = (\<lambda>A. - \<mu> (A \<inter> M2))
E \<in> sets M
E \<subseteq> M1

goal (1 subgoal):
 1. 0 \<le> m2 E
[PROOF STEP]
by (simp add: \<open>E \<in> sets M\<close> sets.Int)
[PROOF STATE]
proof (state)
this:
0 \<le> m2 E

goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
have "\<mu> E \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<mu> E
[PROOF STEP]
using  assms
[PROOF STATE]
proof (prove)
using this:
pos_meas_set M1
neg_meas_set M2
m2 = (\<lambda>A. - \<mu> (A \<inter> M2))
E \<in> sets M
E \<subseteq> M1

goal (1 subgoal):
 1. 0 \<le> \<mu> E
[PROOF STEP]
unfolding pos_meas_set_def
[PROOF STATE]
proof (prove)
using this:
M1 \<in> sets M \<and> (\<forall>A\<in>sets M. A \<subseteq> M1 \<longrightarrow> 0 \<le> \<mu> A)
neg_meas_set M2
m2 = (\<lambda>A. - \<mu> (A \<inter> M2))
E \<in> sets M
E \<subseteq> M1

goal (1 subgoal):
 1. 0 \<le> \<mu> E
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 \<le> \<mu> E

goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> \<mu> E
[PROOF STEP]
have "m2 E \<le> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<mu> E

goal (1 subgoal):
 1. m2 E \<le> 0
[PROOF STEP]
using \<open>\<mu> E \<ge> 0\<close> assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<mu> E
0 \<le> \<mu> E
pos_meas_set M1
neg_meas_set M2
m2 = (\<lambda>A. - \<mu> (A \<inter> M2))
E \<in> sets M
E \<subseteq> M1

goal (1 subgoal):
 1. m2 E \<le> 0
[PROOF STEP]
by (metis \<open>E \<in> sets M\<close> \<open>E \<subseteq> M1\<close> ereal_0_le_uminus_iff ereal_uminus_uminus
        inf_sup_ord(1) neg_meas_setD1 pos_meas_set_def pos_meas_subset
        sets.Int)
[PROOF STATE]
proof (state)
this:
m2 E \<le> 0

goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
thus "m2 E = 0"
[PROOF STATE]
proof (prove)
using this:
m2 E \<le> 0

goal (1 subgoal):
 1. m2 E = 0
[PROOF STEP]
using \<open>m2 E \<ge> 0\<close> \<open>m2 E \<le> 0\<close>
[PROOF STATE]
proof (prove)
using this:
m2 E \<le> 0
0 \<le> m2 E
m2 E \<le> 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_root_gt_zero: "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> 0 < root n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x
[PROOF STEP]
using real_root_less_mono[of n 0 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> root n 0 < root n x

goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < x\<rbrakk> \<Longrightarrow> 0 < root n x
[PROOF STEP]
by simp


[STATEMENT]
lemma isMaxim_max_fun_diff: "\<lbrakk>f \<noteq> g; f \<in> FINFUNC; g \<in> FINFUNC\<rbrakk> \<Longrightarrow>
  s.isMaxim {a \<in> Field s. f a \<noteq> g a} (s.max_fun_diff f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<noteq> g; f \<in> FINFUNC; g \<in> FINFUNC\<rbrakk> \<Longrightarrow> s.isMaxim {a \<in> Field s. f a \<noteq> g a} (s.max_fun_diff f g)
[PROOF STEP]
using fun_unequal_in_support[of f g]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<noteq> g; f \<in> Func ?A ?B; g \<in> Func ?A ?C\<rbrakk> \<Longrightarrow> (support ?z ?A f \<union> support ?z ?A g) \<inter> {a. f a \<noteq> g a} \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>f \<noteq> g; f \<in> FINFUNC; g \<in> FINFUNC\<rbrakk> \<Longrightarrow> s.isMaxim {a \<in> Field s. f a \<noteq> g a} (s.max_fun_diff f g)
[PROOF STEP]
unfolding max_fun_diff_alt fun_diff_alt fun_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> (\<forall>x. f x = g x); f \<in> Func ?A ?B; g \<in> Func ?A ?C\<rbrakk> \<Longrightarrow> (support ?z ?A f \<union> support ?z ?A g) \<inter> {a. f a \<noteq> g a} \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>\<not> (\<forall>x. f x = g x); f \<in> FINFUNC; g \<in> FINFUNC\<rbrakk> \<Longrightarrow> s.isMaxim ((SUPP f \<union> SUPP g) \<inter> {a. f a \<noteq> g a}) (s.maxim ((SUPP f \<union> SUPP g) \<inter> {a. f a \<noteq> g a}))
[PROOF STEP]
by (intro s.maxim_isMaxim) (auto simp: FinFunc_def fin_support_def support_def)


[STATEMENT]
lemma dvd_div_eq_1:
  fixes a b c :: nat
  assumes "c dvd a" "c dvd b" "a div c = b div c"
  shows "a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
using assms dvd_mult_div_cancel[OF \<open>c dvd a\<close>] dvd_mult_div_cancel[OF \<open>c dvd b\<close>]
[PROOF STATE]
proof (prove)
using this:
c dvd a
c dvd b
a div c = b div c
c * (a div c) = a
c * (b div c) = b

goal (1 subgoal):
 1. a = b
[PROOF STEP]
by presburger


[STATEMENT]
lemma enat_cocase_mono [partial_function_mono, cont_intro]:
  "\<lbrakk> monotone orda ordb zero; \<And>n. monotone orda ordb (\<lambda>f. esuc f n) \<rbrakk>
  \<Longrightarrow> monotone orda ordb (\<lambda>f. co.case_enat (zero f) (esuc f) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>monotone orda ordb zero; \<And>n. monotone orda ordb (\<lambda>f. esuc f n)\<rbrakk> \<Longrightarrow> monotone orda ordb (\<lambda>f. case x of 0 \<Rightarrow> zero f | eSuc x \<Rightarrow> esuc f x)
[PROOF STEP]
by(cases x rule: co.enat.exhaust) simp_all


[STATEMENT]
lemma inv_rbt_baliR: "inv2 l \<Longrightarrow> inv2 r \<Longrightarrow> inv1 l \<Longrightarrow> inv1l r \<Longrightarrow> bheight l = bheight r \<Longrightarrow>
  inv1 (rbt_baliR l a b r) \<and> inv2 (rbt_baliR l a b r) \<and> bheight (rbt_baliR l a b r) = Suc (bheight l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inv2 l; inv2 r; inv1 l; inv1l r; bheight l = bheight r\<rbrakk> \<Longrightarrow> inv1 (rbt_baliR l a b r) \<and> inv2 (rbt_baliR l a b r) \<and> bheight (rbt_baliR l a b r) = Suc (bheight l)
[PROOF STEP]
by (induct l a b r rule: rbt_baliR.induct) auto


[STATEMENT]
lemma has_derivative_transform_within_open:
  assumes "(f has_derivative f') (at x within t)"
    and "open s"
    and "x \<in> s"
    and "\<And>x. x\<in>s \<Longrightarrow> f x = g x"
  shows "(g has_derivative f') (at x within t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g has_derivative f') (at x within t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_derivative f') (at x within t)
open s
x \<in> s
?x \<in> s \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. (g has_derivative f') (at x within t)
[PROOF STEP]
unfolding has_derivative_within
[PROOF STATE]
proof (prove)
using this:
bounded_linear f' \<and> ((\<lambda>y. (1 / norm (y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) \<longlongrightarrow> (0::'b)) (at x within t)
open s
x \<in> s
?x \<in> s \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. bounded_linear f' \<and> ((\<lambda>y. (1 / norm (y - x)) *\<^sub>R (g y - (g x + f' (y - x)))) \<longlongrightarrow> (0::'b)) (at x within t)
[PROOF STEP]
by (force simp add: intro: Lim_transform_within_open)


[STATEMENT]
lemma partial_span':
  assumes i: "i \<le> m"
  shows "span (gso ` {0 ..< i}) = span ((\<lambda> j. fs ! j) ` {0 ..< i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (gso ` {0..<i}) = local.span ((!) fs ` {0..<i})
[PROOF STEP]
unfolding partial_span[OF i]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (take i fs)) = local.span ((!) fs ` {0..<i})
[PROOF STEP]
by (rule arg_cong[of _ _ span], subst nth_image, insert i loc_assms, auto)


[STATEMENT]
lemma fst_image_mset_times_mset [simp]:
  "image_mset fst (A \<times># B) = (if B = {#} then {#} else repeat_mset (size B) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset fst (A \<times># B) = (if B = {#} then {#} else repeat_mset (size B) A)
[PROOF STEP]
by (induct B) (auto simp: Times_mset_single_right ac_simps Times_insert_left)


[STATEMENT]
lemma (in aGroup) asumTr:"a \<in> carrier A \<Longrightarrow>
              aSum A (n + m) a = aSum A n a \<plusminus> (aSum A m a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> carrier A \<Longrightarrow> aSum A (n + m) a = aSum A n a \<plusminus> aSum A m a
[PROOF STEP]
apply (induct_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<in> carrier A \<Longrightarrow> aSum A (n + 0) a = aSum A n a \<plusminus> aSum A 0 a
 2. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A (n + Suc na) a = aSum A n a \<plusminus> aSum A (Suc na) a
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<in> carrier A \<Longrightarrow> aSum A n a = aSum A n a \<plusminus> \<zero>
 2. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A (n + Suc na) a = aSum A n a \<plusminus> aSum A (Suc na) a
[PROOF STEP]
apply (frule asum_mem[of a n])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; aSum A n a \<in> carrier A\<rbrakk> \<Longrightarrow> aSum A n a = aSum A n a \<plusminus> \<zero>
 2. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A (n + Suc na) a = aSum A n a \<plusminus> aSum A (Suc na) a
[PROOF STEP]
apply (rule ag_r_zero [THEN sym, of "aSum A n a"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A (n + Suc na) a = aSum A n a \<plusminus> aSum A (Suc na) a
[PROOF STEP]
apply (subgoal_tac "n + Suc na = Suc (n + na)", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A n a \<plusminus> aSum A na a \<plusminus> a = aSum A n a \<plusminus> (aSum A na a \<plusminus> a)
 2. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> n + Suc na = Suc (n + na)
[PROOF STEP]
apply (rule ag_pOp_assoc)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A n a \<in> carrier A
 2. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> aSum A na a \<in> carrier A
 3. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> a \<in> carrier A
 4. \<And>na. \<lbrakk>a \<in> carrier A; aSum A (n + na) a = aSum A n a \<plusminus> aSum A na a\<rbrakk> \<Longrightarrow> n + Suc na = Suc (n + na)
[PROOF STEP]
apply (simp add:asum_mem)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma closed_lsorted: "closed {xs. lsorted xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {xs. lsorted xs}
[PROOF STEP]
unfolding closed_ccpo
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>C. chain C \<longrightarrow> C \<noteq> {} \<longrightarrow> C \<subseteq> Collect lsorted \<longrightarrow> \<Squnion> C \<in> Collect lsorted
[PROOF STEP]
by (auto simp: lsorted_lSup Sup_llist_def subset_eq)


[STATEMENT]
lemma dist_eq_sqrt_dist_code:
  fixes p\<^sub>0 :: point
  shows "dist p\<^sub>0 p\<^sub>1 = sqrt (dist_code p\<^sub>0 p\<^sub>1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (case p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) = sqrt (real_of_int (dist_code p\<^sub>0 p\<^sub>1))
[PROOF STEP]
by (auto simp: dist_prod_def dist_real_def split: prod.splits)


[STATEMENT]
lemma OPT2_is_ub: "set qs \<subseteq> {x,y} \<Longrightarrow> x\<noteq>y \<Longrightarrow> T\<^sub>p [x,y] qs (OPT2 qs [x,y]) \<ge> T\<^sub>p_opt [x,y] qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> T\<^sub>p_opt [x, y] qs \<le> T\<^sub>p [x, y] qs (OPT2 qs [x, y])
[PROOF STEP]
unfolding T_opt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> \<Sqinter> {T\<^sub>p [x, y] qs as |as. length as = length qs} \<le> T\<^sub>p [x, y] qs (OPT2 qs [x, y])
[PROOF STEP]
apply(rule cInf_lower)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> T\<^sub>p [x, y] qs (OPT2 qs [x, y]) \<in> {T\<^sub>p [x, y] qs as |as. length as = length qs}
 2. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> bdd_below {T\<^sub>p [x, y] qs as |as. length as = length qs}
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>as. T\<^sub>p [x, y] qs (OPT2 qs [x, y]) = T\<^sub>p [x, y] qs as \<and> length as = length qs
 2. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> bdd_below {T\<^sub>p [x, y] qs as |as. length as = length qs}
[PROOF STEP]
apply(rule exI[where x="(OPT2 qs [x, y])"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> T\<^sub>p [x, y] qs (OPT2 qs [x, y]) = T\<^sub>p [x, y] qs (OPT2 qs [x, y]) \<and> length (OPT2 qs [x, y]) = length qs
 2. \<lbrakk>set qs \<subseteq> {x, y}; x \<noteq> y\<rbrakk> \<Longrightarrow> bdd_below {T\<^sub>p [x, y] qs as |as. length as = length qs}
[PROOF STEP]
by (auto simp add: OPT2_length)


[STATEMENT]
lemma cGDERIV_DERIV_compose:
  assumes "cGDERIV f x :> df" and "DERIV g (f x) :> cnj dg"
  shows "cGDERIV (\<lambda>x. g (f x)) x :> scaleC dg df"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cGDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>C df
[PROOF STEP]
proof (insert assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>cGDERIV f x :> df; (g has_field_derivative cnj dg) (at (f x))\<rbrakk> \<Longrightarrow> cGDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>C df
[PROOF STEP]
show "cGDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>C df"
    if "cGDERIV f x :> df"
      and "(g has_field_derivative cnj dg) (at (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cGDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>C df
[PROOF STEP]
unfolding cgderiv_def has_field_derivative_def cinner_scaleC_left complex_cnj_cnj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_derivative (\<lambda>y. cnj dg * cinner df y)) (at x)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
cGDERIV f x :> df
(g has_field_derivative cnj dg) (at (f x))

goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_derivative (\<lambda>y. cnj dg * cinner df y)) (at x)
[PROOF STEP]
by (simp add: cgderiv_def has_derivative_compose has_field_derivative_imp_has_derivative)
[PROOF STATE]
proof (state)
this:
\<lbrakk>cGDERIV f x :> df; (g has_field_derivative cnj dg) (at (f x))\<rbrakk> \<Longrightarrow> cGDERIV (\<lambda>x. g (f x)) x :> dg *\<^sub>C df

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hyperplane_face_of_halfspace_ge: "{x. a \<bullet> x = b} face_of {x. a \<bullet> x \<ge> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
[PROOF STEP]
have "{x. a \<bullet> x \<ge> b} \<inter> {x. a \<bullet> x = b} = {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} = {x. a \<bullet> x = b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
[PROOF STEP]
with face_of_Int_supporting_hyperplane_ge [OF convex_halfspace_ge [of b a], of b a]
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> {x. b \<le> a \<bullet> x} \<Longrightarrow> b \<le> a \<bullet> x) \<Longrightarrow> {x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
{x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} = {x. a \<bullet> x = b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {x. b \<le> a \<bullet> x} \<Longrightarrow> b \<le> a \<bullet> x) \<Longrightarrow> {x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
{x. b \<le> a \<bullet> x} \<inter> {x. a \<bullet> x = b} = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. {x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. a \<bullet> x = b} face_of {x. b \<le> a \<bullet> x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_rep_aux_index:
  fixes n m i:: nat
  assumes "n \<ge> 1" and "m < 2^n" and "m \<ge> 0" and "i \<le> n"
  shows "bin_rep_aux n m ! i = (m mod 2^(n-i)) div 2^(n-1-i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
m < 2 ^ n
0 \<le> m
i \<le> n

goal (1 subgoal):
 1. bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i)
[PROOF STEP]
proof(induction n arbitrary: m i rule: nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m i. \<lbrakk>m < 2 ^ 1; 0 \<le> m; i \<le> 1\<rbrakk> \<Longrightarrow> bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)
 2. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:
m < 2 ^ 1
0 \<le> m
i \<le> 1

goal (2 subgoals):
 1. \<And>m i. \<lbrakk>m < 2 ^ 1; 0 \<le> m; i \<le> 1\<rbrakk> \<Longrightarrow> bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)
 2. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
assume "m < 2^1" and "i \<le> 1"
[PROOF STATE]
proof (state)
this:
m < 2 ^ 1
i \<le> 1

goal (2 subgoals):
 1. \<And>m i. \<lbrakk>m < 2 ^ 1; 0 \<le> m; i \<le> 1\<rbrakk> \<Longrightarrow> bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)
 2. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < 2 ^ 1
i \<le> 1
[PROOF STEP]
show "bin_rep_aux 1 m ! i = m mod 2^(1-i) div 2^(1-1-i)"
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ 1
i \<le> 1

goal (1 subgoal):
 1. bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)
[PROOF STEP]
using bin_rep_aux.simps
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ 1
i \<le> 1
bin_rep_aux 0 ?m = [?m]
bin_rep_aux (Suc ?n) ?m = ?m div 2 ^ ?n # bin_rep_aux ?n (?m mod 2 ^ ?n)

goal (1 subgoal):
 1. bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)
[PROOF STEP]
by (metis One_nat_def base.prems(2) diff_is_0_eq' diff_zero div_by_1 le_Suc_eq le_numeral_extra(3)
nth_Cons' power_0 unique_euclidean_semiring_numeral_class.mod_less)
[PROOF STATE]
proof (state)
this:
bin_rep_aux 1 m ! i = m mod 2 ^ (1 - i) div 2 ^ (1 - 1 - i)

goal (1 subgoal):
 1. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
1 \<le> n
\<lbrakk>?m < 2 ^ n; 0 \<le> ?m; ?i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n ?m ! ?i = ?m mod 2 ^ (n - ?i) div 2 ^ (n - 1 - ?i)
m < 2 ^ Suc n
0 \<le> m
i \<le> Suc n

goal (1 subgoal):
 1. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
assume a0:"\<And>m i. m < 2^n \<Longrightarrow> m \<ge> 0 \<Longrightarrow> i \<le> n \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n-i) div 2^(n-1-i)"
and a1:"m < 2^(Suc n)" and a2:"i \<le> Suc n" and a3:"m \<ge> 0"
[PROOF STATE]
proof (state)
this:
\<lbrakk>?m < 2 ^ n; 0 \<le> ?m; ?i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n ?m ! ?i = ?m mod 2 ^ (n - ?i) div 2 ^ (n - 1 - ?i)
m < 2 ^ Suc n
i \<le> Suc n
0 \<le> m

goal (1 subgoal):
 1. \<And>n m i. \<lbrakk>1 \<le> n; \<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; 0 \<le> m; i \<le> Suc n\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?m < 2 ^ n; 0 \<le> ?m; ?i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n ?m ! ?i = ?m mod 2 ^ (n - ?i) div 2 ^ (n - 1 - ?i)
m < 2 ^ Suc n
i \<le> Suc n
0 \<le> m
[PROOF STEP]
show "bin_rep_aux (Suc n) m ! i = m mod 2^(Suc n - i) div 2^(Suc n - 1 - i)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?m < 2 ^ n; 0 \<le> ?m; ?i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n ?m ! ?i = ?m mod 2 ^ (n - ?i) div 2 ^ (n - 1 - ?i)
m < 2 ^ Suc n
i \<le> Suc n
0 \<le> m

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
have "bin_rep_aux (Suc n) m = m div 2^n # bin_rep_aux n (m mod 2^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep_aux (Suc n) m = m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m = m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bin_rep_aux (Suc n) m = m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)
[PROOF STEP]
have f0:"bin_rep_aux (Suc n) m ! i = (m div 2^n # bin_rep_aux n (m mod 2^n)) ! i"
[PROOF STATE]
proof (prove)
using this:
bin_rep_aux (Suc n) m = m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i
[PROOF STEP]
have "bin_rep_aux (Suc n) m ! i = m div 2^n" if "i = 0"
[PROOF STATE]
proof (prove)
using this:
bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m div 2 ^ n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i
i = 0

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m div 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n
[PROOF STEP]
have f1:"bin_rep_aux (Suc n) m ! i = m mod 2^(Suc n - i) div 2^(Suc n - 1 - i)" if "i = 0"
[PROOF STATE]
proof (prove)
using this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
have "m mod 2^(Suc n - i) = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m mod 2 ^ (Suc n - i) = m
[PROOF STEP]
using that a1
[PROOF STATE]
proof (prove)
using this:
i = 0
m < 2 ^ Suc n

goal (1 subgoal):
 1. m mod 2 ^ (Suc n - i) = m
[PROOF STEP]
by (simp add: Suc.prems(2))
[PROOF STATE]
proof (state)
this:
m mod 2 ^ (Suc n - i) = m

goal (1 subgoal):
 1. (i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m mod 2 ^ (Suc n - i) = m
[PROOF STEP]
have "m mod 2^(Suc n - i) div 2^(Suc n - 1 - i) = m div 2^n"
[PROOF STATE]
proof (prove)
using this:
m mod 2 ^ (Suc n - i) = m

goal (1 subgoal):
 1. m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i) = m div 2 ^ n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
m mod 2 ^ (Suc n - i) = m
i = 0

goal (1 subgoal):
 1. m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i) = m div 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i) = m div 2 ^ n

goal (1 subgoal):
 1. (i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m div 2 ^ n) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i) = m div 2 ^ n

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
by (simp add: that)
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
have "bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2^n) ! (i-1)" if "i \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)
[PROOF STEP]
using that f0
[PROOF STATE]
proof (prove)
using this:
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
1 \<le> i
bin_rep_aux (Suc n) m ! i = (m div 2 ^ n # bin_rep_aux n (m mod 2 ^ n)) ! i

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)
[PROOF STEP]
have f2:"bin_rep_aux (Suc n) m ! i = ((m mod 2^n) mod 2^(n - (i - 1))) div 2^(n - 1 - (i - 1))" if "i \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))
[PROOF STEP]
using that a0 a1 a2 a3 Suc.prems(2)
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = bin_rep_aux n (m mod 2 ^ n) ! (i - 1)
1 \<le> i
\<lbrakk>?m < 2 ^ n; 0 \<le> ?m; ?i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n ?m ! ?i = ?m mod 2 ^ (n - ?i) div 2 ^ (n - 1 - ?i)
m < 2 ^ Suc n
i \<le> Suc n
0 \<le> m
0 \<le> m

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))
[PROOF STEP]
have f3:"bin_rep_aux (Suc n) m ! i = ((m mod 2^n) mod 2^(Suc n - i)) div 2^(Suc n - 1 - i)" if "i \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))
1 \<le> i

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
have "bin_rep_aux (Suc n) m ! i = m mod 2^(Suc n - i) div 2^(Suc n - 1 - i)" if "i \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
have "Suc n - i \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n - i \<le> n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 \<le> i

goal (1 subgoal):
 1. Suc n - i \<le> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc n - i \<le> n

goal (1 subgoal):
 1. (1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Suc n - i \<le> n
[PROOF STEP]
have "m mod 2^n mod 2^(Suc n - i) = m mod 2^(Suc n - i)"
[PROOF STATE]
proof (prove)
using this:
Suc n - i \<le> n

goal (1 subgoal):
 1. m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)
[PROOF STEP]
using mod_mod_power_cancel[of "Suc n - i" "n" "m"]
[PROOF STATE]
proof (prove)
using this:
Suc n - i \<le> n
Suc n - i \<le> n \<Longrightarrow> m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)

goal (1 subgoal):
 1. m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)

goal (1 subgoal):
 1. (1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)) \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
using that f3
[PROOF STATE]
proof (prove)
using this:
m mod 2 ^ n mod 2 ^ (Suc n - i) = m mod 2 ^ (Suc n - i)
1 \<le> i
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. \<lbrakk>\<And>m i. \<lbrakk>m < 2 ^ n; 0 \<le> m; i \<le> n\<rbrakk> \<Longrightarrow> bin_rep_aux n m ! i = m mod 2 ^ (n - i) div 2 ^ (n - 1 - i); m < 2 ^ Suc n; i \<le> Suc n; 0 \<le> m\<rbrakk> \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
using f1 f2
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
using linorder_not_less
[PROOF STATE]
proof (prove)
using this:
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
i = 0 \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
1 \<le> i \<Longrightarrow> bin_rep_aux (Suc n) m ! i = m mod 2 ^ n mod 2 ^ (n - (i - 1)) div 2 ^ (n - 1 - (i - 1))
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bin_rep_aux (Suc n) m ! i = m mod 2 ^ (Suc n - i) div 2 ^ (Suc n - 1 - i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_map_frontier_frontier_preimage_subset:
  assumes "continuous_map X Y f"
  shows "X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
have eq: "topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_map X Y f

goal (1 subgoal):
 1. topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}
[PROOF STEP]
unfolding continuous_map_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>topspace X. f x \<in> topspace Y) \<and> (\<forall>U. openin Y U \<longrightarrow> openin X {x \<in> topspace X. f x \<in> U})

goal (1 subgoal):
 1. topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}

goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
have "X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}
[PROOF STEP]
by (simp add: assms continuous_map_closure_preimage_subset)
[PROOF STATE]
proof (state)
this:
X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}

goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}

goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
have "X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}
[PROOF STEP]
using continuous_map_closure_preimage_subset [OF assms] eq
[PROOF STATE]
proof (prove)
using this:
X closure_of {x \<in> topspace X. f x \<in> ?T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of ?T}
topspace X - {x \<in> topspace X. f x \<in> T} = {x \<in> topspace X. f x \<in> topspace Y - T}

goal (1 subgoal):
 1. X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}

goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}
X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
X closure_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of T}
X closure_of (topspace X - {x \<in> topspace X. f x \<in> T}) \<subseteq> {x \<in> topspace X. f x \<in> Y closure_of (topspace Y - T)}

goal (1 subgoal):
 1. X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}
[PROOF STEP]
by (auto simp: frontier_of_closures)
[PROOF STATE]
proof (state)
this:
X frontier_of {x \<in> topspace X. f x \<in> T} \<subseteq> {x \<in> topspace X. f x \<in> Y frontier_of T}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_Ln_complex:
  fixes z :: "nat \<Rightarrow> complex"
  assumes "convergent_prod z" "\<And>k. z k \<noteq> 0"
  shows "summable (\<lambda>k. Ln (z k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>k. Ln (z k))
[PROOF STEP]
using convergent_prod_def assms convergent_prod_iff_summable_complex
[PROOF STATE]
proof (prove)
using this:
convergent_prod ?f \<equiv> \<exists>M p. raw_has_prod ?f M p
convergent_prod z
z ?k \<noteq> 0
(\<And>k. ?z k \<noteq> 0) \<Longrightarrow> convergent_prod ?z = summable (\<lambda>k. Ln (?z k))

goal (1 subgoal):
 1. summable (\<lambda>k. Ln (z k))
[PROOF STEP]
by blast


[STATEMENT]
lemma fromEnum_eq_iff:
  "(fromEnum e = fromEnum f) = (e = f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fromEnum e = fromEnum f) = (e = f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (fromEnum e = fromEnum f) = (e = f)
[PROOF STEP]
have a: "e \<in> set enum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<in> set enum
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e \<in> set enum

goal (1 subgoal):
 1. (fromEnum e = fromEnum f) = (e = f)
[PROOF STEP]
have b: "f \<in> set enum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> set enum
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> set enum

goal (1 subgoal):
 1. (fromEnum e = fromEnum f) = (e = f)
[PROOF STEP]
from nth_the_index[OF a] nth_the_index[OF b]
[PROOF STATE]
proof (chain)
picking this:
enum ! the_index enum e = e
enum ! the_index enum f = f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
enum ! the_index enum e = e
enum ! the_index enum f = f

goal (1 subgoal):
 1. (fromEnum e = fromEnum f) = (e = f)
[PROOF STEP]
unfolding fromEnum_def
[PROOF STATE]
proof (prove)
using this:
enum ! the_index enum e = e
enum ! the_index enum f = f

goal (1 subgoal):
 1. (the_index enum e = the_index enum f) = (e = f)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(fromEnum e = fromEnum f) = (e = f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bools_of_nat_inverse: "nat_of_bools (bools_of_nat k n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply (induct k n rule: bools_of_nat.induct)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply (case_tac "n = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n = 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
 2. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply (case_tac "k = 0")
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n = 0; k = 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
 2. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
 3. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
 2. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat k n) = n
[PROOF STEP]
apply (subst bools_of_nat.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. \<lbrakk>\<lbrakk>n = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) n) = n; n \<noteq> 0 \<Longrightarrow> nat_of_bools (bools_of_nat (k - 1) (n div 2)) = n div 2; n \<noteq> 0\<rbrakk> \<Longrightarrow> nat_of_bools (if n = 0 then if k = 0 then [] else False # bools_of_nat (k - 1) n else (n mod 2 = 1) # bools_of_nat (k - 1) (n div 2)) = n
[PROOF STEP]
apply (simp add: nat_of_bool_mod_eq [simplified] del: bools_of_nat.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done