[STATEMENT]
lemma continuous_map_prod_top:
   "continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x,y). (f x, g y)) \<longleftrightarrow>
    topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
proof (cases "topspace (prod_topology X Y) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace (prod_topology X Y) = {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
 2. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace (prod_topology X Y) = {}

goal (2 subgoals):
 1. topspace (prod_topology X Y) = {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
 2. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (prod_topology X Y) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) = {}

goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
by (simp add: continuous_map_on_empty)
[PROOF STATE]
proof (state)
this:
continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace (prod_topology X Y) \<noteq> {}

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (prod_topology X Y) \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) \<noteq> {}

goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
by (simp add: continuous_map_paired case_prod_unfold continuous_map_of_fst [unfolded o_def] continuous_map_of_snd [unfolded o_def])
[PROOF STATE]
proof (state)
this:
continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r01_to_r01_r01_fst_def':
  "r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2*n)) * (1/2)^(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
have "r01_to_r01_r01_fst_sum r = (\<lambda>n. \<Sum>i=0..n. real (r01_binary_expansion' r (2*i)) * (1/2)^(i+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_to_r01_r01_fst_sum r = (\<lambda>n. \<Sum>i = 0..n. real (r01_binary_expansion' r (2 * i)) * (1 / 2) ^ (i + 1))
[PROOF STEP]
by(auto simp add: r01_to_r01_r01_fst_sum_def r01_binary_sum_def r01_to_r01_r01_fst'_def)
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_fst_sum r = (\<lambda>n. \<Sum>i = 0..n. real (r01_binary_expansion' r (2 * i)) * (1 / 2) ^ (i + 1))

goal (1 subgoal):
 1. r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r01_to_r01_r01_fst_sum r = (\<lambda>n. \<Sum>i = 0..n. real (r01_binary_expansion' r (2 * i)) * (1 / 2) ^ (i + 1))

goal (1 subgoal):
 1. r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
using lim_sum_ai real01_binary_expansion'_0or1
[PROOF STATE]
proof (prove)
using this:
r01_to_r01_r01_fst_sum r = (\<lambda>n. \<Sum>i = 0..n. real (r01_binary_expansion' r (2 * i)) * (1 / 2) ^ (i + 1))
(\<And>n. ?a n \<in> {0, 1}) \<Longrightarrow> lim (\<lambda>n. \<Sum>i = 0..n. real (?a i) * (1 / 2) ^ Suc i) = (\<Sum>n. real (?a n) * (1 / 2) ^ Suc n)
r01_binary_expansion' ?r ?n \<in> {0, 1}

goal (1 subgoal):
 1. r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))
[PROOF STEP]
by(simp add: r01_to_r01_r01_fst_def)
[PROOF STATE]
proof (state)
this:
r01_to_r01_r01_fst r = (\<Sum>n. real (r01_binary_expansion' r (2 * n)) * (1 / 2) ^ (n + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma log2_of_power_le: "\<lbrakk> m \<le> 2 ^ n; m > 0 \<rbrakk> \<Longrightarrow> log 2 m \<le> n" for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> 2 ^ n; 0 < m\<rbrakk> \<Longrightarrow> log 2 (real m) \<le> real n
[PROOF STEP]
using log_of_power_le[of _ 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>real ?m \<le> 2 ^ ?n; 1 < 2; 0 < ?m\<rbrakk> \<Longrightarrow> log 2 (real ?m) \<le> real ?n

goal (1 subgoal):
 1. \<lbrakk>m \<le> 2 ^ n; 0 < m\<rbrakk> \<Longrightarrow> log 2 (real m) \<le> real n
[PROOF STEP]
by simp


[STATEMENT]
lemma det_QR_decomposition:
  fixes A::"real^'n::{mod_type}^'n::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "\<bar>det A\<bar> = \<bar>(prod (\<lambda>i. snd(QR_decomposition A)$i$i) (UNIV::'n set))\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
let ?Q="fst(QR_decomposition A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
let ?R="snd(QR_decomposition A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have det_R: "det ?R = (prod (\<lambda>i. snd(QR_decomposition A)$i$i) (UNIV::'n set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (snd (QR_decomposition A)) = (\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i)
[PROOF STEP]
apply (rule det_upperdiagonal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
using upper_triangular_snd_QR_decomposition[OF r]
[PROOF STATE]
proof (prove)
using this:
upper_triangular (snd (QR_decomposition A))

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
unfolding upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. j < i \<longrightarrow> snd (QR_decomposition A) $ i $ j = 0

goal (1 subgoal):
 1. \<And>i j. j < i \<Longrightarrow> snd (QR_decomposition A) $ i $ j = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (snd (QR_decomposition A)) = (\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i)

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have "\<bar>det A\<bar> = \<bar>det ?Q * det ?R\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
by (metis QR_decomposition_mult det_mul r)
[PROOF STATE]
proof (state)
this:
\<bar>det A\<bar> = \<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>det A\<bar> = \<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have "... = \<bar>det ?Q\<bar> * \<bar>det ?R\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar> = \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
unfolding abs_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar> = \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar> = \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>det (fst (QR_decomposition A)) * det (snd (QR_decomposition A))\<bar> = \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have "... = 1 * \<bar>det ?R\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar> = 1 * \<bar>det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
using det_orthogonal_matrix[OF orthogonal_matrix_fst_QR_decomposition'[OF r]]
[PROOF STATE]
proof (prove)
using this:
det (fst (QR_decomposition A)) = 1 \<or> det (fst (QR_decomposition A)) = - 1

goal (1 subgoal):
 1. \<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar> = 1 * \<bar>det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar> = 1 * \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>det (fst (QR_decomposition A))\<bar> * \<bar>det (snd (QR_decomposition A))\<bar> = 1 * \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have "... = \<bar>det ?R\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * \<bar>det (snd (QR_decomposition A))\<bar> = \<bar>det (snd (QR_decomposition A))\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 * \<bar>det (snd (QR_decomposition A))\<bar> = \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 * \<bar>det (snd (QR_decomposition A))\<bar> = \<bar>det (snd (QR_decomposition A))\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
have "... = \<bar>(prod (\<lambda>i. snd(QR_decomposition A)$i$i) (UNIV::'n set))\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>det (snd (QR_decomposition A))\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
unfolding det_R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<bar>det (snd (QR_decomposition A))\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>

goal (1 subgoal):
 1. \<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>det A\<bar> = \<bar>\<Prod>i\<in>UNIV. snd (QR_decomposition A) $ i $ i\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_frontier_cball [simp]:
    fixes a :: "'n::euclidean_space"
    shows "rel_frontier(cball a r) = (if r = 0 then {} else sphere a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
proof (cases rule: linorder_cases [of r 0])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. r < 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 2. r = 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 3. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
r < 0

goal (3 subgoals):
 1. r < 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 2. r = 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 3. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r < 0

goal (1 subgoal):
 1. rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
by (force simp: sphere_def)
[PROOF STATE]
proof (state)
this:
rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 2. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r = 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 2. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
case equal
[PROOF STATE]
proof (state)
this:
r = 0

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
 2. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = 0

goal (1 subgoal):
 1. rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)

goal (1 subgoal):
 1. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. 0 < r \<Longrightarrow> rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < r

goal (1 subgoal):
 1. rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)
[PROOF STEP]
by simp (metis centre_in_ball empty_iff frontier_cball frontier_def interior_cball interior_rel_interior_gen rel_frontier_def)
[PROOF STATE]
proof (state)
this:
rel_frontier (cball a r) = (if r = 0 then {} else sphere a r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_scaleR_left:
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
  shows   "infsetsum (\<lambda>x. f x *\<^sub>R c) A = infsetsum f A *\<^sub>R c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x *\<^sub>R c) = infsetsum f A *\<^sub>R c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<Longrightarrow> f abs_summable_on A

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x *\<^sub>R c) = infsetsum f A *\<^sub>R c
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a) \<Longrightarrow> integrable (count_space A) f

goal (1 subgoal):
 1. LINT x|count_space A. f x *\<^sub>R c = integral\<^sup>L (count_space A) f *\<^sub>R c
[PROOF STEP]
by (rule Bochner_Integration.integral_scaleR_left)


[STATEMENT]
lemma has_complex_derivative_funpow_1:
     "\<lbrakk>(f has_field_derivative 1) (at z); f z = z\<rbrakk> \<Longrightarrow> (f^^n has_field_derivative 1) (at z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ 0 has_field_derivative (1::'a)) (at z)
 2. \<And>n. \<lbrakk>\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z); (f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
(f has_field_derivative (1::'a)) (at z)
f z = z

goal (2 subgoals):
 1. \<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ 0 has_field_derivative (1::'a)) (at z)
 2. \<And>n. \<lbrakk>\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z); (f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_field_derivative (1::'a)) (at z)
f z = z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative (1::'a)) (at z)
f z = z

goal (1 subgoal):
 1. (f ^^ 0 has_field_derivative (1::'a)) (at z)
[PROOF STEP]
by (simp add: id_def)
[PROOF STATE]
proof (state)
this:
(f ^^ 0 has_field_derivative (1::'a)) (at z)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z); (f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z); (f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z)
(f has_field_derivative (1::'a)) (at z)
f z = z

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z); (f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z)
(f has_field_derivative (1::'a)) (at z)
f z = z
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f has_field_derivative (1::'a)) (at z); f z = z\<rbrakk> \<Longrightarrow> (f ^^ n has_field_derivative (1::'a)) (at z)
(f has_field_derivative (1::'a)) (at z)
f z = z

goal (1 subgoal):
 1. (f ^^ Suc n has_field_derivative (1::'a)) (at z)
[PROOF STEP]
by (metis DERIV_chain funpow_Suc_right mult.right_neutral)
[PROOF STATE]
proof (state)
this:
(f ^^ Suc n has_field_derivative (1::'a)) (at z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_list_map_filter: "prod_list (map g (filter f xs)) * prod_list (map g (filter (\<lambda> x. \<not> f x) xs))
  = prod_list (map g xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map g (filter f xs)) * prod_list (map g (filter (\<lambda>x. \<not> f x) xs)) = prod_list (map g xs)
[PROOF STEP]
by (induct xs, auto simp: ac_simps)


[STATEMENT]
lemma cos_double_sin: "cos (2 * w) = 1 - 2 * sin w ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos ((2::'a) * w) = (1::'a) - (2::'a) * (sin w)\<^sup>2
[PROOF STEP]
by (simp add: cos_double sin_squared_eq)


[STATEMENT]
lemma fib_closed_form':
  fixes \<phi> \<psi> :: real
  defines "\<phi> \<equiv> (1 + sqrt 5) / 2"
    and "\<psi> \<equiv> (1 - sqrt 5) / 2"
  assumes "n > 0"
  shows "fib n = round (\<phi> ^ n / sqrt 5)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (fib n) = round (\<phi> ^ n / sqrt 5)
[PROOF STEP]
proof (rule sym, rule round_unique')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
have "\<bar>\<phi> ^ n / sqrt 5 - of_int (int (fib n))\<bar> = \<bar>\<psi>\<bar> ^ n / sqrt 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> = \<bar>\<psi>\<bar> ^ n / sqrt 5
[PROOF STEP]
by (simp add: fib_closed_form[folded \<phi>_def \<psi>_def] field_simps power_abs)
[PROOF STATE]
proof (state)
this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> = \<bar>\<psi>\<bar> ^ n / sqrt 5

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> = \<bar>\<psi>\<bar> ^ n / sqrt 5

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> = \<bar>\<psi>\<bar> ^ n / sqrt 5

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<phi> \<equiv> (1 + sqrt 5) / 2
\<psi> \<equiv> (1 - sqrt 5) / 2
0 < n
[PROOF STEP]
have "\<bar>\<psi>\<bar>^n \<le> \<bar>\<psi>\<bar>^1"
[PROOF STATE]
proof (prove)
using this:
\<phi> \<equiv> (1 + sqrt 5) / 2
\<psi> \<equiv> (1 - sqrt 5) / 2
0 < n

goal (1 subgoal):
 1. \<bar>\<psi>\<bar> ^ n \<le> \<bar>\<psi>\<bar> ^ 1
[PROOF STEP]
by (intro power_decreasing) (simp_all add: algebra_simps real_le_lsqrt)
[PROOF STATE]
proof (state)
this:
\<bar>\<psi>\<bar> ^ n \<le> \<bar>\<psi>\<bar> ^ 1

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>\<psi>\<bar> ^ n \<le> \<bar>\<psi>\<bar> ^ 1

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
have "\<dots> < sqrt 5 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<psi>\<bar> ^ 1 < sqrt 5 / 2
[PROOF STEP]
by (simp add: \<psi>_def field_simps)
[PROOF STATE]
proof (state)
this:
\<bar>\<psi>\<bar> ^ 1 < sqrt 5 / 2

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>\<psi>\<bar> ^ n < sqrt 5 / 2
[PROOF STEP]
have "\<bar>\<psi>\<bar>^n / sqrt 5 < 1/2"
[PROOF STATE]
proof (prove)
using this:
\<bar>\<psi>\<bar> ^ n < sqrt 5 / 2

goal (1 subgoal):
 1. \<bar>\<psi>\<bar> ^ n / sqrt 5 < 1 / 2
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<bar>\<psi>\<bar> ^ n / sqrt 5 < 1 / 2

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<bar>\<psi>\<bar> ^ n / sqrt 5 < 1 / 2

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
show "\<bar>\<phi> ^ n / sqrt 5 - of_int (int (fib n))\<bar> < 1/2"
[PROOF STATE]
proof (prove)
using this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2

goal (1 subgoal):
 1. \<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>\<phi> ^ n / sqrt 5 - real_of_int (int (fib n))\<bar> < 1 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tanh_ln_real:
  "tanh (ln x :: real) = (x ^ 2 - 1) / (x ^ 2 + 1)" if "x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "(x * 2 - inverse x * 2) * (x\<^sup>2 + 1) =
    (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. (x * 2 - inverse x * 2) * (x\<^sup>2 + 1) = (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(x * 2 - inverse x * 2) * (x\<^sup>2 + 1) = (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(x * 2 - inverse x * 2) * (x\<^sup>2 + 1) = (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
have "x\<^sup>2 + 1 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x\<^sup>2 + 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. 0 < x\<^sup>2 + 1
[PROOF STEP]
by (simp add: ac_simps add_pos_nonneg)
[PROOF STATE]
proof (state)
this:
0 < x\<^sup>2 + 1

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < x\<^sup>2 + 1

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
have "2 * x + 2 * inverse x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 2 * x + 2 * inverse x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. 0 < 2 * x + 2 * inverse x
[PROOF STEP]
by (simp add: add_pos_pos)
[PROOF STATE]
proof (state)
this:
0 < 2 * x + 2 * inverse x

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(x * 2 - inverse x * 2) * (x\<^sup>2 + 1) = (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)
0 < x\<^sup>2 + 1
0 < 2 * x + 2 * inverse x
[PROOF STEP]
have "(x * 2 - inverse x * 2) /
    (2 * x + 2 * inverse x) =
    (x\<^sup>2 - 1) / (x\<^sup>2 + 1)"
[PROOF STATE]
proof (prove)
using this:
(x * 2 - inverse x * 2) * (x\<^sup>2 + 1) = (x\<^sup>2 - 1) * (2 * x + 2 * inverse x)
0 < x\<^sup>2 + 1
0 < 2 * x + 2 * inverse x

goal (1 subgoal):
 1. (x * 2 - inverse x * 2) / (2 * x + 2 * inverse x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
by (simp add: frac_eq_eq)
[PROOF STATE]
proof (state)
this:
(x * 2 - inverse x * 2) / (2 * x + 2 * inverse x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
0 < x
(x * 2 - inverse x * 2) / (2 * x + 2 * inverse x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < x
(x * 2 - inverse x * 2) / (2 * x + 2 * inverse x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)

goal (1 subgoal):
 1. tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)
[PROOF STEP]
by (simp add: tanh_def sinh_ln_real cosh_ln_real)
[PROOF STATE]
proof (state)
this:
tanh (ln x) = (x\<^sup>2 - 1) / (x\<^sup>2 + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_double: "cosh (2 * x) = cosh x ^ 2 + sinh x ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh ((2::'a) * x) = (cosh x)\<^sup>2 + (sinh x)\<^sup>2
[PROOF STEP]
using cosh_add[of x]
[PROOF STATE]
proof (prove)
using this:
cosh (x + x) = cosh x * cosh x + sinh x * sinh x

goal (1 subgoal):
 1. cosh ((2::'a) * x) = (cosh x)\<^sup>2 + (sinh x)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma choose_rising_sum:
  "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose (n + 1))"
  "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1) &&& (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)
 2. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
show "(\<Sum>j\<le>m. ((n + j) choose n)) = ((n + m + 1) choose (n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)
[PROOF STEP]
by (induct m) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose (n + 1)

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
have "\<dots> = (n + m + 1) choose m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n + m + 1 choose (n + 1) = n + m + 1 choose m
[PROOF STEP]
by (subst binomial_symmetric) simp_all
[PROOF STATE]
proof (state)
this:
n + m + 1 choose (n + 1) = n + m + 1 choose m

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
show "(\<Sum>j\<le>m. ((n + j) choose n)) = (n + m + 1) choose m"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m

goal (1 subgoal):
 1. (\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<le>m. n + j choose n) = n + m + 1 choose m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l2wi_negation_type_intersect_alt: "wordinterval_to_set (l2wi_negation_type_intersect l) =
                wordinterval_to_set (wordinterval_setminus (l2wi_intersect (getPos l)) (l2wi (getNeg l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_negation_type_intersect l) = wordinterval_to_set (wordinterval_setminus (l2wi_intersect (getPos l)) (l2wi (getNeg l)))
[PROOF STEP]
apply(simp add: l2wi_intersect l2wi)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (l2wi_negation_type_intersect l) = (\<Inter>x\<in>set (getPos l). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg l). case x of (i, j) \<Rightarrow> {i..j})
[PROOF STEP]
apply(induction l rule :l2wi_negation_type_intersect.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. wordinterval_to_set (l2wi_negation_type_intersect []) = (\<Inter>x\<in>set (getPos []). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg []). case x of (i, j) \<Rightarrow> {i..j})
 2. \<And>s e ls. wordinterval_to_set (l2wi_negation_type_intersect ls) = (\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j}) \<Longrightarrow> wordinterval_to_set (l2wi_negation_type_intersect (Pos (s, e) # ls)) = (\<Inter>x\<in>set (getPos (Pos (s, e) # ls)). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg (Pos (s, e) # ls)). case x of (i, j) \<Rightarrow> {i..j})
 3. \<And>s e ls. wordinterval_to_set (l2wi_negation_type_intersect ls) = (\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j}) \<Longrightarrow> wordinterval_to_set (l2wi_negation_type_intersect (Neg (s, e) # ls)) = (\<Inter>x\<in>set (getPos (Neg (s, e) # ls)). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg (Neg (s, e) # ls)). case x of (i, j) \<Rightarrow> {i..j})
[PROOF STEP]
apply(simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s e ls. wordinterval_to_set (l2wi_negation_type_intersect ls) = (\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j}) \<Longrightarrow> {s..e} \<inter> ((\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j})) = {s..e} \<inter> (\<Inter>(x, y)\<in>set (getPos ls). {x..y}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j})
 2. \<And>s e ls. wordinterval_to_set (l2wi_negation_type_intersect ls) = (\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j}) \<Longrightarrow> (UNIV - {s..e}) \<inter> ((\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - (\<Union>x\<in>set (getNeg ls). case x of (i, j) \<Rightarrow> {i..j})) = (\<Inter>x\<in>set (getPos ls). case x of (i, j) \<Rightarrow> {i..j}) - ({s..e} \<union> (\<Union>(x, y)\<in>set (getNeg ls). {x..y}))
[PROOF STEP]
apply(fast)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exists_solve_consistent_rref:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
assumes rref: "reduced_row_echelon_form A"
shows "(\<exists>i. A $ i $ j = 1 \<and> j = (LEAST n. A $ i $ n \<noteq> 0))
  = (IArray.exists (\<lambda>i. (matrix_to_iarray A) !! i !! (to_nat j) = 1
  \<and> (to_nat j)=least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray[0..<nrows_iarray (matrix_to_iarray A)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))) = IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])
[PROOF STEP]
proof (rule)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a)) \<Longrightarrow> IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])
 2. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
assume "\<exists>i. A $ i $ j = 1 \<and> j = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
\<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (2 subgoals):
 1. \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a)) \<Longrightarrow> IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])
 2. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
obtain i where Aij: "A $ i $ j = 1" and j_eq: "j = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>A $ i $ j = (1::'a); j = (LEAST n. A $ i $ n \<noteq> (0::'a))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ i $ j = (1::'a)
j = (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (2 subgoals):
 1. \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a)) \<Longrightarrow> IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])
 2. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
show "IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! to_nat j = 1 \<and> to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A)))
     (IArray [0..<nrows_iarray (matrix_to_iarray A)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding IArray.exists_def find_Some_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<in>set (IArray.list_of (IArray [0..<nrows_iarray (matrix_to_iarray A)])). matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))
[PROOF STEP]
apply (rule bexI[of _ "to_nat i"])+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
 2. mod_type_class.to_nat i \<in> set (IArray.list_of (IArray [0..<nrows_iarray (matrix_to_iarray A)]))
[PROOF STEP]
proof (auto, unfold IArray.sub_def[symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
 3. mod_type_class.to_nat i < nrows_iarray (matrix_to_iarray A)
[PROOF STEP]
show "to_nat i < nrows_iarray (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat i < nrows_iarray (matrix_to_iarray A)
[PROOF STEP]
unfolding matrix_to_iarray_nrows[symmetric] nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat i < CARD('rows)
[PROOF STEP]
using to_nat_less_card
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat ?j < CARD(?'a)

goal (1 subgoal):
 1. mod_type_class.to_nat i < CARD('rows)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat i < nrows_iarray (matrix_to_iarray A)

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
have "to_nat j = to_nat (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat j = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
unfolding j_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a)) = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a))

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
have "... = to_nat (LEAST n. A $ i $ n \<noteq> 0 \<and> 0\<le>n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a)) = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)
[PROOF STEP]
by (metis least_mod_type)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a)) = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a)) = mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
have "...= least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (to_nat (0::'cols))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (mod_type_class.to_nat (0::'cols))
[PROOF STEP]
proof (rule vec_to_iarray_least_non_zero_position_of_vector_from_index''[symmetric, of "0::'cols" i A])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row i A))
[PROOF STEP]
show "\<not> vector_all_zero_from_index (to_nat (0::'cols), vec_to_iarray (row i A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row i A))
[PROOF STEP]
unfolding vector_all_zero_from_index_eq[symmetric, of "0::'cols" "row i A"]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>m\<ge>0::'cols. row i A $ m = (0::'a))
[PROOF STEP]
unfolding row_def vec_nth_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>m\<ge>0::'cols. A $ i $ m = (0::'a))
[PROOF STEP]
using Aij least_mod_type[of j]
[PROOF STATE]
proof (prove)
using this:
A $ i $ j = (1::'a)
(0::'cols) \<le> j

goal (1 subgoal):
 1. \<not> (\<forall>m\<ge>0::'cols. A $ i $ m = (0::'a))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row i A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (mod_type_class.to_nat (0::'cols))

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (LEAST n. A $ i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (mod_type_class.to_nat (0::'cols))

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
have "... = least_non_zero_position_of_vector (row_iarray (to_nat i) (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (mod_type_class.to_nat (0::'cols)) = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
unfolding vec_to_iarray_row least_non_zero_position_of_vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A)) (mod_type_class.to_nat (0::'cols)) = least_non_zero_position_of_vector_from_index (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A)) 0
[PROOF STEP]
unfolding to_nat_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A)) 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector_from_index (vec_to_iarray (row i A)) (mod_type_class.to_nat (0::'cols)) = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))

goal (2 subgoals):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
 2. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
show "to_nat j = least_non_zero_position_of_vector (row_iarray (to_nat i) (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))

goal (1 subgoal):
 1. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A))

goal (1 subgoal):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
[PROOF STEP]
show "matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)
[PROOF STEP]
unfolding matrix_to_iarray_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ i $ j = (1::'a)
[PROOF STEP]
using Aij
[PROOF STATE]
proof (prove)
using this:
A $ i $ j = (1::'a)

goal (1 subgoal):
 1. A $ i $ j = (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_to_iarray A !! mod_type_class.to_nat i !! mod_type_class.to_nat j = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])

goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
assume ex_eq: "IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! to_nat j = 1 \<and> to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A)))
     (IArray [0..<nrows_iarray (matrix_to_iarray A)])"
[PROOF STATE]
proof (state)
this:
IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])

goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
have "\<exists>y. List.find (\<lambda>i. matrix_to_iarray A !! i !! to_nat j = 1 \<and> to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A)))
         [0..<nrows_iarray (matrix_to_iarray A)] = Some y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y. find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y
[PROOF STEP]
proof (rule ccontr, simp del: IArray.length_def IArray.sub_def, unfold find_None_iff)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A)) \<Longrightarrow> False
[PROOF STEP]
assume" \<not> (\<exists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and>
            matrix_to_iarray A !! x !! mod_type_class.to_nat j = 1 \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A)))"
[PROOF STATE]
proof (state)
this:
\<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A))

goal (1 subgoal):
 1. \<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A)) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
\<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A))

goal (1 subgoal):
 1. False
[PROOF STEP]
using ex_eq
[PROOF STATE]
proof (prove)
using this:
\<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A))
IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)])

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding IArray.exists_def
[PROOF STATE]
proof (prove)
using this:
\<nexists>x. x \<in> set [0..<nrows_iarray (matrix_to_iarray A)] \<and> matrix_to_iarray A !! x !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray x (matrix_to_iarray A))
\<exists>i\<in>set (IArray.list_of (IArray [0..<nrows_iarray (matrix_to_iarray A)])). matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>y. find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y

goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>y. find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y
[PROOF STEP]
obtain y where y: "List.find (\<lambda>i. matrix_to_iarray A !! i !! to_nat j = 1 \<and> to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A)))
         [0..<nrows_iarray (matrix_to_iarray A)] = Some y"
[PROOF STATE]
proof (prove)
using this:
\<exists>y. find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y

goal (1 subgoal):
 1. (\<And>y. find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y

goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y
[PROOF STEP]
obtain i where i_less_length: "i<length [0..<nrows_iarray (matrix_to_iarray A)]" and
     Aij_1: "matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! to_nat j = 1"
and j_eq: "to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))" and
  y_eq: "y = [0..<nrows_iarray (matrix_to_iarray A)] ! i"
    and least: "(\<forall>ja<i. \<not> (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) !! to_nat j = 1 \<and>
                to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) (matrix_to_iarray A))))"
[PROOF STATE]
proof (prove)
using this:
find (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) [0..<nrows_iarray (matrix_to_iarray A)] = Some y

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length [0..<nrows_iarray (matrix_to_iarray A)]; matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! mod_type_class.to_nat j = (1::'a); mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A)); y = [0..<nrows_iarray (matrix_to_iarray A)] ! i; \<forall>ja<i. \<not> (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) (matrix_to_iarray A)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding find_Some_iff
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length [0..<nrows_iarray (matrix_to_iarray A)]. (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))) \<and> y = [0..<nrows_iarray (matrix_to_iarray A)] ! i \<and> (\<forall>ja<i. \<not> (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) (matrix_to_iarray A))))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length [0..<nrows_iarray (matrix_to_iarray A)]; matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! mod_type_class.to_nat j = (1::'a); mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A)); y = [0..<nrows_iarray (matrix_to_iarray A)] ! i; \<forall>ja<i. \<not> (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) (matrix_to_iarray A)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i < length [0..<nrows_iarray (matrix_to_iarray A)]
matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! mod_type_class.to_nat j = (1::'a)
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))
y = [0..<nrows_iarray (matrix_to_iarray A)] ! i
\<forall>ja<i. \<not> (matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! ja) (matrix_to_iarray A)))

goal (1 subgoal):
 1. IArray.exists (\<lambda>i. matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a) \<and> mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray i (matrix_to_iarray A))) (IArray [0..<nrows_iarray (matrix_to_iarray A)]) \<Longrightarrow> \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
show "\<exists>i. A $ i $ j = 1 \<and> j = (LEAST n. A $ i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))
[PROOF STEP]
proof (rule exI[of _ "from_nat i"], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
 2. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have i_rw: "[0..<nrows_iarray (matrix_to_iarray A)] ! i = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<nrows_iarray (matrix_to_iarray A)] ! i = i
[PROOF STEP]
using nth_upt[of 0 i "nrows_iarray (matrix_to_iarray A)"]
[PROOF STATE]
proof (prove)
using this:
0 + i < nrows_iarray (matrix_to_iarray A) \<Longrightarrow> [0..<nrows_iarray (matrix_to_iarray A)] ! i = 0 + i

goal (1 subgoal):
 1. [0..<nrows_iarray (matrix_to_iarray A)] ! i = i
[PROOF STEP]
using i_less_length
[PROOF STATE]
proof (prove)
using this:
0 + i < nrows_iarray (matrix_to_iarray A) \<Longrightarrow> [0..<nrows_iarray (matrix_to_iarray A)] ! i = 0 + i
i < length [0..<nrows_iarray (matrix_to_iarray A)]

goal (1 subgoal):
 1. [0..<nrows_iarray (matrix_to_iarray A)] ! i = i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[0..<nrows_iarray (matrix_to_iarray A)] ! i = i

goal (2 subgoals):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
 2. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have i_less_card: "i < CARD ('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
using i_less_length
[PROOF STATE]
proof (prove)
using this:
i < length [0..<nrows_iarray (matrix_to_iarray A)]

goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
unfolding nrows_iarray_def matrix_to_iarray_def
[PROOF STATE]
proof (prove)
using this:
i < length [0..<IArray.length (IArray (map (vec_to_iarray \<circ> ($) A \<circ> mod_type_class.from_nat) [0..<CARD('rows)]))]

goal (1 subgoal):
 1. i < CARD('rows)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < CARD('rows)

goal (2 subgoals):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
 2. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
show A_ij: "A $ from_nat i $ j = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
[PROOF STEP]
using Aij_1
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray A !! ([0..<nrows_iarray (matrix_to_iarray A)] ! i) !! mod_type_class.to_nat j = (1::'a)

goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
[PROOF STEP]
unfolding i_rw
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a)

goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
[PROOF STEP]
using matrix_to_iarray_nth[of A "from_nat i" j]
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a)
matrix_to_iarray A !! mod_type_class.to_nat (mod_type_class.from_nat i) !! mod_type_class.to_nat j = A $ mod_type_class.from_nat i $ j

goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
[PROOF STEP]
unfolding to_nat_from_nat_id[OF i_less_card]
[PROOF STATE]
proof (prove)
using this:
matrix_to_iarray A !! i !! mod_type_class.to_nat j = (1::'a)
matrix_to_iarray A !! i !! mod_type_class.to_nat j = A $ mod_type_class.from_nat i $ j

goal (1 subgoal):
 1. A $ mod_type_class.from_nat i $ j = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A $ mod_type_class.from_nat i $ j = (1::'a)

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have "to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))
[PROOF STEP]
using j_eq
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))

goal (1 subgoal):
 1. mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j = least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have "... = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A)) = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0
[PROOF STEP]
unfolding least_non_zero_position_of_vector_def i_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A)) = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector (row_iarray ([0..<nrows_iarray (matrix_to_iarray A)] ! i) (matrix_to_iarray A)) = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have "... = least_non_zero_position_of_vector_from_index (vec_to_iarray (row (from_nat i) A)) (to_nat (0::'cols))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols))
[PROOF STEP]
unfolding vec_to_iarray_row
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (row_iarray (mod_type_class.to_nat (mod_type_class.from_nat i)) (matrix_to_iarray A)) (mod_type_class.to_nat (0::'cols))
[PROOF STEP]
unfolding to_nat_from_nat_id[OF i_less_card]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) (mod_type_class.to_nat (0::'cols))
[PROOF STEP]
unfolding to_nat_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector_from_index (row_iarray i (matrix_to_iarray A)) 0 = least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have "... = to_nat (LEAST n. A $ (from_nat i) $ n \<noteq> 0 \<and> 0 \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols)) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)
[PROOF STEP]
proof (rule vec_to_iarray_least_non_zero_position_of_vector_from_index'')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row (mod_type_class.from_nat i) A))
[PROOF STEP]
show "\<not> vector_all_zero_from_index (to_nat (0::'cols), vec_to_iarray (row (from_nat i) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row (mod_type_class.from_nat i) A))
[PROOF STEP]
unfolding vector_all_zero_from_index_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>m\<ge>0::'cols. row (mod_type_class.from_nat i) A $ m = (0::'a))
[PROOF STEP]
using A_ij
[PROOF STATE]
proof (prove)
using this:
A $ mod_type_class.from_nat i $ j = (1::'a)

goal (1 subgoal):
 1. \<not> (\<forall>m\<ge>0::'cols. row (mod_type_class.from_nat i) A $ m = (0::'a))
[PROOF STEP]
by (metis iarray_to_vec_vec_to_iarray least_mod_type vec_matrix vec_to_iarray_row' zero_neq_one)
[PROOF STATE]
proof (state)
this:
\<not> vector_all_zero_from_index (mod_type_class.to_nat (0::'cols), vec_to_iarray (row (mod_type_class.from_nat i) A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols)) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
least_non_zero_position_of_vector_from_index (vec_to_iarray (row (mod_type_class.from_nat i) A)) (mod_type_class.to_nat (0::'cols)) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n)

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
have "... = to_nat (LEAST n. A $ (from_nat i) $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
using least_mod_type
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<le> ?n

goal (1 subgoal):
 1. mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a) \<and> (0::'cols) \<le> n) = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mod_type_class.to_nat j = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
show "j = (LEAST n. A $ from_nat i $ n \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat j = mod_type_class.to_nat (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
unfolding to_nat_eq
[PROOF STATE]
proof (prove)
using this:
j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))

goal (1 subgoal):
 1. j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
j = (LEAST n. A $ mod_type_class.from_nat i $ n \<noteq> (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>i. A $ i $ j = (1::'a) \<and> j = (LEAST n. A $ i $ n \<noteq> (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_triangle_num:
  "real (triangle_num n) = real n * (real n + 1) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (triangle_num n) = real n * (real n + 1) / 2
[PROOF STEP]
by (simp add: triangle_num_def field_char_0_class.of_nat_div algebra_simps)


[STATEMENT]
lemma unit_ball_vol_numeral:
  "unit_ball_vol (numeral (Num.Bit0 n)) = pi ^ numeral n / fact (numeral n)" (is ?th1)
  "unit_ball_vol (numeral (Num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) /
    fact (2 * Suc (numeral n)) * pi ^ numeral n" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n) &&& unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)
 2. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
have "numeral (Num.Bit0 n) = (2 * numeral n :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral (num.Bit0 n) = 2 * numeral n
[PROOF STEP]
by (simp only: numeral_Bit0 mult_2 ring_distribs)
[PROOF STATE]
proof (state)
this:
numeral (num.Bit0 n) = 2 * numeral n

goal (2 subgoals):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)
 2. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
numeral (num.Bit0 n) = 2 * numeral n

goal (2 subgoals):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)
 2. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
have "unit_ball_vol \<dots> = pi ^ numeral n / fact (numeral n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_ball_vol (real (2 * numeral n)) = pi ^ numeral n / fact (numeral n)
[PROOF STEP]
by (rule unit_ball_vol_even)
[PROOF STATE]
proof (state)
this:
unit_ball_vol (real (2 * numeral n)) = pi ^ numeral n / fact (numeral n)

goal (2 subgoals):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)
 2. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
unit_ball_vol (real (numeral (num.Bit0 n))) = pi ^ numeral n / fact (numeral n)
[PROOF STEP]
show ?th1
[PROOF STATE]
proof (prove)
using this:
unit_ball_vol (real (numeral (num.Bit0 n))) = pi ^ numeral n / fact (numeral n)

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_ball_vol (numeral (num.Bit0 n)) = pi ^ numeral n / fact (numeral n)

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
have "numeral (Num.Bit1 n) = (2 * numeral n + 1 :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral (num.Bit1 n) = 2 * numeral n + 1
[PROOF STEP]
by (simp only: numeral_Bit1 mult_2)
[PROOF STATE]
proof (state)
this:
numeral (num.Bit1 n) = 2 * numeral n + 1

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
numeral (num.Bit1 n) = 2 * numeral n + 1

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
have "unit_ball_vol \<dots> = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) /
                                  fact (2 * Suc (numeral n)) * pi ^ numeral n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_ball_vol (real (2 * numeral n + 1)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
by (rule unit_ball_vol_odd)
[PROOF STATE]
proof (state)
this:
unit_ball_vol (real (2 * numeral n + 1)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
unit_ball_vol (real (numeral (num.Bit1 n))) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
show ?th2
[PROOF STATE]
proof (prove)
using this:
unit_ball_vol (real (numeral (num.Bit1 n))) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n

goal (1 subgoal):
 1. unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_ball_vol (numeral (num.Bit1 n)) = 2 ^ (2 * Suc (numeral n)) * fact (Suc (numeral n)) / fact (2 * Suc (numeral n)) * pi ^ numeral n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosine_rule:
  fixes a b c :: "real ^ ('n::finite)"
  shows "(norm_dist a c)\<^sup>2 =
  (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))
[PROOF STEP]
have "(a - b) + (b - c) = a - c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b + (b - c) = a - c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a - b + (b - c) = a - c

goal (1 subgoal):
 1. (norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))
[PROOF STEP]
with dot_norm [of "a - b" "b - c"]
[PROOF STATE]
proof (chain)
picking this:
(a - b) \<bullet> (b - c) = ((norm (a - b + (b - c)))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2
a - b + (b - c) = a - c
[PROOF STEP]
have "(a - b) \<bullet> (b - c) =
        ((norm (a - c))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2"
[PROOF STATE]
proof (prove)
using this:
(a - b) \<bullet> (b - c) = ((norm (a - b + (b - c)))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2
a - b + (b - c) = a - c

goal (1 subgoal):
 1. (a - b) \<bullet> (b - c) = ((norm (a - c))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(a - b) \<bullet> (b - c) = ((norm (a - c))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2

goal (1 subgoal):
 1. (norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(a - b) \<bullet> (b - c) = ((norm (a - c))\<^sup>2 - (norm (a - b))\<^sup>2 - (norm (b - c))\<^sup>2) / 2

goal (1 subgoal):
 1. (norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(norm_dist a c)\<^sup>2 = (norm_dist a b)\<^sup>2 + (norm_dist b c)\<^sup>2 + 2 * ((a - b) \<bullet> (b - c))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcsin_0 [simp]: "arcsin 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcsin 0 = 0
[PROOF STEP]
using arcsin_sin [of 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (pi / 2) \<le> 0; 0 \<le> pi / 2\<rbrakk> \<Longrightarrow> arcsin (sin 0) = 0

goal (1 subgoal):
 1. arcsin 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_list_map_power2:
  shows "sum_list (map power2 ls) \<ge> (0::real poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sum_list (map power2 ls)
[PROOF STEP]
apply (induct ls)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 \<le> sum_list (map power2 [])
 2. \<And>a ls. 0 \<le> sum_list (map power2 ls) \<Longrightarrow> 0 \<le> sum_list (map power2 (a # ls))
[PROOF STEP]
by auto


[STATEMENT]
lemma two_powrs_div:
  assumes "j < (i::nat) "
  shows "((2^i) div ((2::nat)^(Suc j)))*2 =  ((2^i) div (2^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j * 2 = 2 ^ i div 2 ^ j
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j * 2 = 2 ^ i div 2 ^ j
[PROOF STEP]
have "((2::nat)^i) div (2^(Suc j)) = 2^(i -1) div(2^ j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j = 2 ^ (i - 1) div 2 ^ j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < i

goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j = 2 ^ (i - 1) div 2 ^ j
[PROOF STEP]
by (smt (z3) One_nat_def add_le_cancel_left diff_Suc_Suc div_by_Suc_0 div_if less_nat_zero_code plus_1_eq_Suc power_diff_power_eq zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
2 ^ i div 2 ^ Suc j = 2 ^ (i - 1) div 2 ^ j

goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j * 2 = 2 ^ i div 2 ^ j
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ i div 2 ^ Suc j = 2 ^ (i - 1) div 2 ^ j

goal (1 subgoal):
 1. 2 ^ i div 2 ^ Suc j * 2 = 2 ^ i div 2 ^ j
[PROOF STEP]
by (metis Suc_diff_Suc Suc_leI assms less_imp_le_nat mult.commute power_Suc power_diff_power_eq zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
2 ^ i div 2 ^ Suc j * 2 = 2 ^ i div 2 ^ j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma last_take_conv_nth: assumes "n < length xs" shows "last (take (Suc n) xs) = xs!n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (take (Suc n) xs) = xs ! n
[PROOF STEP]
unfolding take_Suc_conv_app_nth[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (take n xs \<cdot> [xs ! n]) = xs ! n
[PROOF STEP]
by simp


[STATEMENT]
lemma pos_bounded: "\<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K
[PROOF STEP]
obtain K where "\<And>a b. norm (a ** b) \<le> norm a * norm b * K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>K. (\<And>a b. norm (a ** b) \<le> norm a * norm b * K) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bounded
[PROOF STATE]
proof (prove)
using this:
\<exists>K. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K

goal (1 subgoal):
 1. (\<And>K. (\<And>a b. norm (a ** b) \<le> norm a * norm b * K) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * K

goal (1 subgoal):
 1. \<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * K
[PROOF STEP]
have "norm (a ** b) \<le> norm a * norm b * (max 1 K)" for a b
[PROOF STATE]
proof (prove)
using this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * K

goal (1 subgoal):
 1. norm (a ** b) \<le> norm a * norm b * max 1 K
[PROOF STEP]
by (rule order.trans) (simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * max 1 K

goal (1 subgoal):
 1. \<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * max 1 K
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (?a ** ?b) \<le> norm ?a * norm ?b * max 1 K

goal (1 subgoal):
 1. \<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>K>0. \<forall>a b. norm (a ** b) \<le> norm a * norm b * K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reciprocal_mult:
  fixes P Q::"'a::{ring_char_0,field} poly"
  assumes "degree (P * Q) \<le> p"
    and "degree P \<le> p" and "degree Q \<le> p"
  shows "monom 1 p * reciprocal_poly p (P * Q) =
         reciprocal_poly p P * reciprocal_poly p Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
proof (cases "P=0 \<or> Q=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P = 0 \<or> Q = 0 \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
 2. \<not> (P = 0 \<or> Q = 0) \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
P = 0 \<or> Q = 0

goal (2 subgoals):
 1. P = 0 \<or> Q = 0 \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
 2. \<not> (P = 0 \<or> Q = 0) \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P = 0 \<or> Q = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
P = 0 \<or> Q = 0

goal (1 subgoal):
 1. monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
P = 0 \<or> Q = 0
degree (P * Q) \<le> p

goal (1 subgoal):
 1. monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
by (auto simp: reciprocal_fcompose fcompose_mult)
[PROOF STATE]
proof (state)
this:
monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q

goal (1 subgoal):
 1. \<not> (P = 0 \<or> Q = 0) \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (P = 0 \<or> Q = 0) \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (P = 0 \<or> Q = 0)

goal (1 subgoal):
 1. \<not> (P = 0 \<or> Q = 0) \<Longrightarrow> monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (P = 0 \<or> Q = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (P = 0 \<or> Q = 0)

goal (1 subgoal):
 1. monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> (P = 0 \<or> Q = 0)
degree (P * Q) \<le> p
degree P \<le> p
degree Q \<le> p

goal (1 subgoal):
 1. monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q
[PROOF STEP]
by (auto simp: degree_mult_eq mult_monom reciprocal_fcompose fcompose_mult)
[PROOF STATE]
proof (state)
this:
monom (1::'a) p * reciprocal_poly p (P * Q) = reciprocal_poly p P * reciprocal_poly p Q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_squared_le_one:
  fixes x:: real
  shows "(sin x)\<^sup>2 \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin x)\<^sup>2 \<le> 1
[PROOF STEP]
using abs_sin_le_one abs_square_le_1
[PROOF STATE]
proof (prove)
using this:
\<bar>sin ?x\<bar> \<le> 1
(?x\<^sup>2 \<le> (1::?'a)) = (\<bar>?x\<bar> \<le> (1::?'a))

goal (1 subgoal):
 1. (sin x)\<^sup>2 \<le> 1
[PROOF STEP]
by blast


[STATEMENT]
lemma power_minus_is_div:
  "b \<le> a \<Longrightarrow> (2 :: nat) ^ (a - b) = 2 ^ a div 2 ^ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b
[PROOF STEP]
apply (induct a arbitrary: b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. b \<le> 0 \<Longrightarrow> 2 ^ (0 - b) = 2 ^ 0 div 2 ^ b
 2. \<And>a b. \<lbrakk>\<And>b. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b; b \<le> Suc a\<rbrakk> \<Longrightarrow> 2 ^ (Suc a - b) = 2 ^ Suc a div 2 ^ b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>\<And>b. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b; b \<le> Suc a\<rbrakk> \<Longrightarrow> 2 ^ (Suc a - b) = 2 ^ Suc a div 2 ^ b
[PROOF STEP]
apply (erule le_SucE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>\<And>b. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b; b \<le> a\<rbrakk> \<Longrightarrow> 2 ^ (Suc a - b) = 2 ^ Suc a div 2 ^ b
 2. \<And>a b. \<lbrakk>\<And>b. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b; b = Suc a\<rbrakk> \<Longrightarrow> 2 ^ (Suc a - b) = 2 ^ Suc a div 2 ^ b
[PROOF STEP]
apply (clarsimp simp:Suc_diff_le le_iff_add power_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>\<And>b. b \<le> a \<Longrightarrow> 2 ^ (a - b) = 2 ^ a div 2 ^ b; b = Suc a\<rbrakk> \<Longrightarrow> 2 ^ (Suc a - b) = 2 ^ Suc a div 2 ^ b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


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

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


[STATEMENT]
lemma infsetsum_conv_nn_integral:
  assumes "nn_integral (count_space A) f \<noteq> \<infinity>" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
  shows   "infsetsum f A = enn2real (nn_integral (count_space A) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f A = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A)
[PROOF STEP]
unfolding infsetsum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A \<noteq> \<infinity>
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. integral\<^sup>L (count_space A) f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A)
[PROOF STEP]
by (subst integral_eq_nn_integral) auto


[STATEMENT]
lemma hnorm_triangle_ineq3: "\<And>x y::'a::real_normed_vector star. \<bar>hnorm x - hnorm y\<bar> \<le> hnorm (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<bar>hnorm x - hnorm y\<bar> \<le> hnorm (x - y)
[PROOF STEP]
by transfer (rule norm_triangle_ineq3)


[STATEMENT]
lemma de_morgan_orthogonal_complement_inter:
  fixes A B::"'a::chilbert_space set"
  assumes a1: \<open>closed_csubspace A\<close> and a2: \<open>closed_csubspace B\<close>
  shows  \<open>orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
have \<open>orthogonal_complement A +\<^sub>M orthogonal_complement B
    = orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement A +\<^sub>M orthogonal_complement B = orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B))
[PROOF STEP]
by (simp add: closed_subspace_closed_sum)
[PROOF STATE]
proof (state)
this:
orthogonal_complement A +\<^sub>M orthogonal_complement B = orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B))

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
orthogonal_complement A +\<^sub>M orthogonal_complement B = orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B))

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
have \<open>\<dots> = orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B)) = orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B))
[PROOF STEP]
by (simp add: de_morgan_orthogonal_complement_plus orthogonal_complementI)
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B)) = orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B))

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement (orthogonal_complement A +\<^sub>M orthogonal_complement B)) = orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B))

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
have \<open>\<dots> = orthogonal_complement (A \<inter> B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B)) = orthogonal_complement (A \<inter> B)
[PROOF STEP]
by (simp add: a1 a2)
[PROOF STATE]
proof (state)
this:
orthogonal_complement (orthogonal_complement (orthogonal_complement A) \<inter> orthogonal_complement (orthogonal_complement B)) = orthogonal_complement (A \<inter> B)

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
orthogonal_complement A +\<^sub>M orthogonal_complement B = orthogonal_complement (A \<inter> B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
orthogonal_complement A +\<^sub>M orthogonal_complement B = orthogonal_complement (A \<inter> B)

goal (1 subgoal):
 1. orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
orthogonal_complement (A \<inter> B) = orthogonal_complement A +\<^sub>M orthogonal_complement B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcs_graph_G_ge_2vertsG:
  "\<lbrakk>graph G; connected G\<rbrakk> \<Longrightarrow> card (arcs G) \<ge> 2 * (card (verts G) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>graph G; Digraph_Component.connected G\<rbrakk> \<Longrightarrow> 2 * (card (verts G) - 1) \<le> card (arcs G)
[PROOF STEP]
using arcs_graph_G_ge_2vertsT connected_verts_G_eq_T
[PROOF STATE]
proof (prove)
using this:
graph G \<Longrightarrow> 2 * (card (verts T) - 1) \<le> card (arcs G)
\<lbrakk>graph G; Digraph_Component.connected G\<rbrakk> \<Longrightarrow> verts T = verts G

goal (1 subgoal):
 1. \<lbrakk>graph G; Digraph_Component.connected G\<rbrakk> \<Longrightarrow> 2 * (card (verts G) - 1) \<le> card (arcs G)
[PROOF STEP]
by simp