[STATEMENT]
lemma dim_gen_eigenspace_jordan_matrix:
  "dim_gen_eigenspace (jordan_matrix n_as) ev k
    = (\<Sum> n \<leftarrow> map fst [(n, e)\<leftarrow>n_as . e = ev]. min k n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?JM = "\<lambda> n_as. jordan_matrix n_as"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?CM = "\<lambda> n_as. char_matrix (?JM n_as) ev"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?A = "\<lambda> n_as. (?CM n_as) ^\<^sub>m k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?n = "\<lambda> n_as. sum_list (map fst n_as)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?C = "\<lambda> n_as. carrier_mat (?n n_as) (?n n_as)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?sum = "\<lambda> n_as. \<Sum> n \<leftarrow> map fst [(n, e)\<leftarrow>n_as . e = ev]. min k n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?dim = "\<lambda> n_as. sum_list (map fst n_as)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
let ?kdim = "\<lambda> n_as. kernel.dim (?dim n_as) (?A n_as)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
have JM: "\<And> n_as. ?JM n_as \<in> ?C n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n_as. jordan_matrix n_as \<in> carrier_mat (sum_list (map fst n_as)) (sum_list (map fst n_as))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
jordan_matrix ?n_as4 \<in> carrier_mat (sum_list (map fst ?n_as4)) (sum_list (map fst ?n_as4))

goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
have CM: "\<And> n_as. ?CM n_as \<in> ?C n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n_as. char_matrix (jordan_matrix n_as) ev \<in> carrier_mat (sum_list (map fst n_as)) (sum_list (map fst n_as))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_matrix ?n_as5) ev \<in> carrier_mat (sum_list (map fst ?n_as5)) (sum_list (map fst ?n_as5))

goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
have A: "\<And> n_as. ?A n_as \<in> ?C n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n_as. char_matrix (jordan_matrix n_as) ev ^\<^sub>m k \<in> carrier_mat (sum_list (map fst n_as)) (sum_list (map fst n_as))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_matrix ?n_as5) ev ^\<^sub>m k \<in> carrier_mat (sum_list (map fst ?n_as5)) (sum_list (map fst ?n_as5))

goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
have dimc: "dim_col (?JM n_as) = ?dim n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (jordan_matrix n_as) = sum_list (map fst n_as)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (jordan_matrix n_as) = sum_list (map fst n_as)

goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
interpret K: kernel "?dim n_as" "?dim n_as" "?A n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel (sum_list (map fst n_as)) (sum_list (map fst n_as)) (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)
[PROOF STEP]
by (unfold_locales, rule A)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
unfolding dim_gen_eigenspace_def K.kernel_dim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K.dim = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))
[PROOF STEP]
proof (induct n_as)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
 2. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
 2. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have "?JM Nil = 1\<^sub>m 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. jordan_matrix [] = 1\<^sub>m 0
[PROOF STEP]
unfolding jordan_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>(x, y). jordan_block x y) []) = 1\<^sub>m 0
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
jordan_matrix [] = 1\<^sub>m 0

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
 2. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
hence id: "?A Nil = 1\<^sub>m 0"
[PROOF STATE]
proof (prove)
using this:
jordan_matrix [] = 1\<^sub>m 0

goal (1 subgoal):
 1. char_matrix (jordan_matrix []) ev ^\<^sub>m k = 1\<^sub>m 0
[PROOF STEP]
unfolding char_matrix_def
[PROOF STATE]
proof (prove)
using this:
jordan_matrix [] = 1\<^sub>m 0

goal (1 subgoal):
 1. (jordan_matrix [] + - ev \<cdot>\<^sub>m 1\<^sub>m (dim_row (jordan_matrix []))) ^\<^sub>m k = 1\<^sub>m 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_matrix []) ev ^\<^sub>m k = 1\<^sub>m 0

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
 2. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (1\<^sub>m 0)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
[PROOF STEP]
using kernel_one_mat[of 0]
[PROOF STATE]
proof (prove)
using this:
vectorspace.dim class_ring (module_vec TYPE(?'a) 0\<lparr>carrier := mat_kernel (1\<^sub>m 0)\<rparr>) = 0
vectorspace.basis class_ring (module_vec TYPE(?'a) 0\<lparr>carrier := mat_kernel (1\<^sub>m 0)\<rparr>) {}

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (1\<^sub>m 0)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst []))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix []) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) [])))

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
case (Cons ne n_as')
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as')))

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?n_as = "Cons ne n_as'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?d = "?dim ?n_as"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?d' = "?dim n_as'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
obtain n e where ne: "ne = (n,e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n e. ne = (n, e) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
ne = (n, e)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have dim: "?d = n + ?d'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map fst (ne # n_as')) = n + sum_list (map fst n_as')
[PROOF STEP]
unfolding ne
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map fst ((n, e) # n_as')) = n + sum_list (map fst n_as')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map fst (ne # n_as')) = n + sum_list (map fst n_as')

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?jb = "jordan_block n e"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?cm = "char_matrix ?jb ev"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
let ?a = "?cm ^\<^sub>m k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have a: "?a \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_matrix (jordan_block n e) ev ^\<^sub>m k \<in> carrier_mat n n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_block n e) ev ^\<^sub>m k \<in> carrier_mat n n

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
from JM[of n_as']
[PROOF STATE]
proof (chain)
picking this:
jordan_matrix n_as' \<in> carrier_mat (sum_list (map fst n_as')) (sum_list (map fst n_as'))
[PROOF STEP]
have dim_rec: "dim_row (?JM n_as') = ?d'" "dim_col (?JM n_as') = ?d'"
[PROOF STATE]
proof (prove)
using this:
jordan_matrix n_as' \<in> carrier_mat (sum_list (map fst n_as')) (sum_list (map fst n_as'))

goal (1 subgoal):
 1. dim_row (jordan_matrix n_as') = sum_list (map fst n_as') &&& dim_col (jordan_matrix n_as') = sum_list (map fst n_as')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (jordan_matrix n_as') = sum_list (map fst n_as')
dim_col (jordan_matrix n_as') = sum_list (map fst n_as')

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
hence JM_id: "?JM ?n_as = four_block_mat ?jb (0\<^sub>m n ?d') (0\<^sub>m ?d' n) (?JM n_as')"
[PROOF STATE]
proof (prove)
using this:
dim_row (jordan_matrix n_as') = sum_list (map fst n_as')
dim_col (jordan_matrix n_as') = sum_list (map fst n_as')

goal (1 subgoal):
 1. jordan_matrix (ne # n_as') = four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as')
[PROOF STEP]
unfolding ne jordan_matrix_def
[PROOF STATE]
proof (prove)
using this:
dim_row (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as')) = sum_list (map fst n_as')
dim_col (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as')) = sum_list (map fst n_as')

goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>(x, y). jordan_block x y) ((n, e) # n_as')) = four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as'))
[PROOF STEP]
using JM[of n_as']
[PROOF STATE]
proof (prove)
using this:
dim_row (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as')) = sum_list (map fst n_as')
dim_col (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as')) = sum_list (map fst n_as')
jordan_matrix n_as' \<in> carrier_mat (sum_list (map fst n_as')) (sum_list (map fst n_as'))

goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>(x, y). jordan_block x y) ((n, e) # n_as')) = four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (diag_block_mat (map (\<lambda>(x, y). jordan_block x y) n_as'))
[PROOF STEP]
by (simp add: Let_def)
[PROOF STATE]
proof (state)
this:
jordan_matrix (ne # n_as') = four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as')

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have CM_id: "?CM ?n_as = four_block_mat ?cm (0\<^sub>m n ?d') (0\<^sub>m ?d' n) (?CM n_as')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_matrix (jordan_matrix (ne # n_as')) ev = four_block_mat (char_matrix (jordan_block n e) ev) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev)
[PROOF STEP]
unfolding JM_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_matrix (four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as')) ev = four_block_mat (char_matrix (jordan_block n e) ev) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev)
[PROOF STEP]
unfolding char_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as') + - ev \<cdot>\<^sub>m 1\<^sub>m (dim_row (four_block_mat (jordan_block n e) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as'))) = four_block_mat (jordan_block n e + - ev \<cdot>\<^sub>m 1\<^sub>m (dim_row (jordan_block n e))) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (jordan_matrix n_as' + - ev \<cdot>\<^sub>m 1\<^sub>m (dim_row (jordan_matrix n_as')))
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_matrix (ne # n_as')) ev = four_block_mat (char_matrix (jordan_block n e) ev) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have A_id: "?A ?n_as = four_block_mat ?a (0\<^sub>m n ?d') (0\<^sub>m ?d' n) (?A n_as')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k = four_block_mat (char_matrix (jordan_block n e) ev ^\<^sub>m k) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)
[PROOF STEP]
unfolding CM_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (char_matrix (jordan_block n e) ev) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev) ^\<^sub>m k = four_block_mat (char_matrix (jordan_block n e) ev ^\<^sub>m k) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)
[PROOF STEP]
by (rule pow_four_block_mat[OF _ CM], auto)
[PROOF STATE]
proof (state)
this:
char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k = four_block_mat (char_matrix (jordan_block n e) ev ^\<^sub>m k) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have kdim: "?kdim ?n_as = kernel.dim n ?a + ?kdim n_as'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) + vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>)
[PROOF STEP]
unfolding dim A_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (n + sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (four_block_mat (char_matrix (jordan_block n e) ev ^\<^sub>m k) (0\<^sub>m n (sum_list (map fst n_as'))) (0\<^sub>m (sum_list (map fst n_as')) n) (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k))\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) + vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>)
[PROOF STEP]
by (rule kernel_four_block_0_mat[OF refl a A])
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) + vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) + vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have "?kdim n_as' = ?sum n_as'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as')))
[PROOF STEP]
by (rule Cons)
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as')))

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as'))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as') ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as')))

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have "kernel.dim n ?a = (if e = ev then min k n else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) = (if e = ev then min k n else 0)
[PROOF STEP]
using dim_kernel_zero_jordan_block_pow[of n k]
        dim_kernel_non_zero_jordan_block_pow[of "e - ev" n k]
[PROOF STATE]
proof (prove)
using this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
e - ev \<noteq> (0::'a) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (e - ev) ^\<^sub>m k)\<rparr>) = 0

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) = (if e = ev then min k n else 0)
[PROOF STEP]
unfolding char_matrix_jordan_block
[PROOF STATE]
proof (prove)
using this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (0::'a) ^\<^sub>m k)\<rparr>) = min k n
e - ev \<noteq> (0::'a) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (e - ev) ^\<^sub>m k)\<rparr>) = 0

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (jordan_block n (e - ev) ^\<^sub>m k)\<rparr>) = (if e = ev then min k n else 0)
[PROOF STEP]
by (cases "e = ev", auto)
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) = (if e = ev then min k n else 0)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (char_matrix (jordan_block n e) ev ^\<^sub>m k)\<rparr>) = (if e = ev then min k n else 0)

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
have "\<dots> + ?sum n_as' = ?sum ?n_as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if e = ev then min k n else 0) + sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as'))) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) (ne # n_as'))))
[PROOF STEP]
unfolding ne
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if e = ev then min k n else 0) + sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as'))) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) ((n, e) # n_as'))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if e = ev then min k n else 0) + sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as'))) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) (ne # n_as'))))

goal (1 subgoal):
 1. \<And>a n_as. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst n_as))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix n_as) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) n_as))) \<Longrightarrow> vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (a # n_as)))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (a # n_as)) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (a # n_as))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) (ne # n_as'))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) (ne # n_as'))))

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (ne # n_as'))))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) (sum_list (map fst (ne # n_as')))\<lparr>carrier := mat_kernel (char_matrix (jordan_matrix (ne # n_as')) ev ^\<^sub>m k)\<rparr>) = sum_list (map (min k) (map fst (filter (\<lambda>a. case a of (n, e) \<Rightarrow> e = ev) (ne # n_as'))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.dim_gen_eigenspace (jordan_matrix n_as) ev k = sum_list (map (min k) (map fst (filter (\<lambda>(n, e). e = ev) n_as)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reciprocal_monom:
  assumes "n \<le> p"
  shows "reciprocal_poly p (monom a n) = monom a (p-n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
proof (cases "a=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = (0::'a) \<Longrightarrow> reciprocal_poly p (monom a n) = monom a (p - n)
 2. a \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = (0::'a)

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

goal (1 subgoal):
 1. reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
by (simp add: reciprocal_0)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (monom a n) = monom a (p - n)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a)

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
with \<open>n\<le>p\<close>
[PROOF STATE]
proof (chain)
picking this:
n \<le> p
a \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<le> p
a \<noteq> (0::'a)

goal (1 subgoal):
 1. reciprocal_poly p (monom a n) = monom a (p - n)
[PROOF STEP]
apply (rule_tac poly_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>n \<le> p; a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> coeff (reciprocal_poly p (monom a n)) na = coeff (monom a (p - n)) na
[PROOF STEP]
by (metis coeff_monom coeff_reciprocal coeff_reciprocal_less
        diff_diff_cancel diff_le_self lead_coeff_monom not_le_imp_less)
[PROOF STATE]
proof (state)
this:
reciprocal_poly p (monom a n) = monom a (p - n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lin_indpt_list_length_le_n: assumes "lin_indpt_list xs"
  shows "length xs \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
from assms[unfolded lin_indpt_list_def]
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> carrier_vec n \<and> distinct xs \<and> lin_indpt (set xs)
[PROOF STEP]
have xs: "set xs \<subseteq> carrier_vec n" and dist: "distinct xs" and lin: "lin_indpt (set xs)"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> carrier_vec n \<and> distinct xs \<and> lin_indpt (set xs)

goal (1 subgoal):
 1. set xs \<subseteq> carrier_vec n &&& distinct xs &&& lin_indpt (set xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> carrier_vec n
distinct xs
lin_indpt (set xs)

goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
from dist
[PROOF STATE]
proof (chain)
picking this:
distinct xs
[PROOF STEP]
have "card (set xs) = length xs"
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. card (set xs) = length xs
[PROOF STEP]
by (rule distinct_card)
[PROOF STATE]
proof (state)
this:
card (set xs) = length xs

goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (set xs) = length xs

goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
have "card (set xs) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set xs) \<le> n
[PROOF STEP]
using lin xs dim_is_n li_le_dim(2)
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set xs)
set xs \<subseteq> carrier_vec n
local.dim = n
\<lbrakk>fin_dim; ?A \<subseteq> carrier_vec n; lin_indpt ?A\<rbrakk> \<Longrightarrow> card ?A \<le> local.dim

goal (1 subgoal):
 1. card (set xs) \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set xs) \<le> n

goal (1 subgoal):
 1. length xs \<le> n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (set xs) = length xs
card (set xs) \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (set xs) = length xs
card (set xs) \<le> n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma VectorSpaceEndSet_is_VectorSpaceHomSet :
  "VectorSpaceHomSet smult V smult V = {T. VEnd T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<cdot>) V = VectorSpaceEndSet
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. VectorSpaceHomSet (\<cdot>) V (\<cdot>) V \<subseteq> VectorSpaceEndSet
 2. VectorSpaceEndSet \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V
[PROOF STEP]
show "VectorSpaceHomSet smult V smult V \<subseteq> {T. VEnd T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<cdot>) V \<subseteq> VectorSpaceEndSet
[PROOF STEP]
using VectorSpaceHomSetD_VectorSpaceHom VectorSpaceHomSetD_Im
          VectorSpaceEndI
[PROOF STATE]
proof (prove)
using this:
?T \<in> VectorSpaceHomSet ?fsmult ?V ?fsmult' ?N \<Longrightarrow> VectorSpaceHom ?fsmult ?V ?fsmult' ?T
?T \<in> VectorSpaceHomSet ?fsmult ?V ?fsmult' ?W \<Longrightarrow> ?T ` ?V \<subseteq> ?W
\<lbrakk>VectorSpaceHom ?smult ?V ?smult ?T; ?T ` ?V \<subseteq> ?V\<rbrakk> \<Longrightarrow> VectorSpaceEnd ?smult ?V ?T

goal (1 subgoal):
 1. VectorSpaceHomSet (\<cdot>) V (\<cdot>) V \<subseteq> VectorSpaceEndSet
[PROOF STEP]
by    fast
[PROOF STATE]
proof (state)
this:
VectorSpaceHomSet (\<cdot>) V (\<cdot>) V \<subseteq> VectorSpaceEndSet

goal (1 subgoal):
 1. VectorSpaceEndSet \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V
[PROOF STEP]
show "VectorSpaceHomSet smult V smult V \<supseteq> {T. VEnd T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceEndSet \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V
[PROOF STEP]
using VectorSpaceEnd.VectorSpaceHom[of smult V]
          VectorSpaceEnd.endomorph[of smult V]
          VectorSpaceHomSetI[of smult V smult _ V]
[PROOF STATE]
proof (prove)
using this:
VEnd ?T \<Longrightarrow> VectorSpaceHom (\<cdot>) V (\<cdot>) ?T
VEnd ?T \<Longrightarrow> ?T ` V \<subseteq> V
\<lbrakk>VectorSpaceHom (\<cdot>) V (\<cdot>) ?T; ?T ` V \<subseteq> V\<rbrakk> \<Longrightarrow> ?T \<in> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V

goal (1 subgoal):
 1. VectorSpaceEndSet \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
VectorSpaceEndSet \<subseteq> VectorSpaceHomSet (\<cdot>) V (\<cdot>) V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma represents_add:
  assumes x: "p represents x" and y: "q represents y"
  shows "(poly_add p q) represents (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_add p q represents x + y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p represents x
q represents y

goal (1 subgoal):
 1. poly_add p q represents x + y
[PROOF STEP]
by (intro representsI ipoly_poly_add ipoly_poly_add_nonzero, auto)


[STATEMENT]
lemma inner_mult_diag_expand:
  fixes B::"complex Matrix.mat"
  assumes "diagonal_mat B"
  and "B \<in> carrier_mat n n"
  and "v \<in> carrier_vec n"
shows "inner_prod (B *\<^sub>v v) v =
  (\<Sum> i \<in> {0 ..< n}. (conjugate (B $$ (i,i))) * (vec_index v i *
      (conjugate (vec_index v i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
have  idx: "\<And>i. i < n \<Longrightarrow> vec_index (B *\<^sub>v v) i = B $$ (i,i) * (vec_index v i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> (B *\<^sub>v v) $ i = B $$ (i, i) * v $ i
[PROOF STEP]
using assms diagonal_mat_mult_vec
[PROOF STATE]
proof (prove)
using this:
diagonal_mat B
B \<in> carrier_mat n n
v \<in> carrier_vec n
\<lbrakk>diagonal_mat ?B; ?B \<in> carrier_mat ?n ?n; ?v \<in> carrier_vec ?n; ?i < ?n\<rbrakk> \<Longrightarrow> (?B *\<^sub>v ?v) $ ?i = ?B $$ (?i, ?i) * ?v $ ?i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> (B *\<^sub>v v) $ i = B $$ (i, i) * v $ i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> (B *\<^sub>v v) $ ?i = B $$ (?i, ?i) * v $ ?i

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
have "inner_prod (B *\<^sub>v v) v =
    (\<Sum> i \<in> {0 ..< n}. vec_index v i * vec_index (conjugate (B *\<^sub>v v)) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i)
[PROOF STEP]
unfolding Matrix.scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (B *\<^sub>v v)). v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat B
B \<in> carrier_mat n n
v \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (conjugate (B *\<^sub>v v)). v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i)

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i)

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< n}. vec_index v i * conjugate (vec_index (B *\<^sub>v v) i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat B
B \<in> carrier_mat n n
v \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i))

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. v $ i * conjugate (B *\<^sub>v v) $ i) = (\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i))

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< n}. (conjugate (B $$ (i,i))) * (vec_index v i *
      (conjugate (vec_index v i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i)) = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
proof (rule sum.cong, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<n} \<Longrightarrow> v $ x * conjugate ((B *\<^sub>v v) $ x) = conjugate (B $$ (x, x)) * (v $ x * conjugate (v $ x))
[PROOF STEP]
show "\<And>i. i \<in> {0 ..< n} \<Longrightarrow> vec_index v i * conjugate (vec_index (B *\<^sub>v v) i) =
      (conjugate (B $$ (i,i))) * (vec_index v i * (conjugate (vec_index v i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {0..<n} \<Longrightarrow> v $ i * conjugate ((B *\<^sub>v v) $ i) = conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i))
[PROOF STEP]
by (simp add:  idx)
[PROOF STATE]
proof (state)
this:
?i \<in> {0..<n} \<Longrightarrow> v $ ?i * conjugate ((B *\<^sub>v v) $ ?i) = conjugate (B $$ (?i, ?i)) * (v $ ?i * conjugate (v $ ?i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. v $ i * conjugate ((B *\<^sub>v v) $ i)) = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))

goal (1 subgoal):
 1. Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod (B *\<^sub>v v) v = (\<Sum>i = 0..<n. conjugate (B $$ (i, i)) * (v $ i * conjugate (v $ i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Edges_rev_disj: "distinct xs \<Longrightarrow> Edges(rev xs) \<inter> Edges(xs) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> Edges (rev xs) \<inter> Edges xs = {}
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct [] \<Longrightarrow> Edges (rev []) \<inter> Edges [] = {}
 2. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> Edges (rev xs) \<inter> Edges xs = {}; distinct (a # xs)\<rbrakk> \<Longrightarrow> Edges (rev (a # xs)) \<inter> Edges (a # xs) = {}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct xs \<Longrightarrow> Edges (rev xs) \<inter> Edges xs = {}; distinct (a # xs)\<rbrakk> \<Longrightarrow> Edges (rev (a # xs)) \<inter> Edges (a # xs) = {}
[PROOF STEP]
apply(auto simp:Edges_Cons Edges_append last_rev
      notinset_notinEdge1 notinset_notinEdge2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma asymp_equiv_imp_eventually_same_sign:
  fixes f g :: "real \<Rightarrow> real"
  assumes "f \<sim>[F] g"
  shows   "eventually (\<lambda>x. sgn (f x) = sgn (g x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f \<sim>[F] g
[PROOF STEP]
have "((\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> sgn 1) F"
[PROOF STATE]
proof (prove)
using this:
f \<sim>[F] g

goal (1 subgoal):
 1. ((\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> sgn 1) F
[PROOF STEP]
unfolding asymp_equiv_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<longlongrightarrow> 1) F

goal (1 subgoal):
 1. ((\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> sgn 1) F
[PROOF STEP]
by (rule tendsto_sgn) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)) \<longlongrightarrow> sgn 1) F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)
[PROOF STEP]
from order_tendstoD(1)[OF this, of "1/2"]
[PROOF STATE]
proof (chain)
picking this:
1 / 2 < sgn 1 \<Longrightarrow> \<forall>\<^sub>F x in F. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)
[PROOF STEP]
have "eventually (\<lambda>x. sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x) > 1/2) F"
[PROOF STATE]
proof (prove)
using this:
1 / 2 < sgn 1 \<Longrightarrow> \<forall>\<^sub>F x in F. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)
[PROOF STEP]
thus "eventually (\<lambda>x. sgn (f x) = sgn (g x)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<Longrightarrow> sgn (f x) = sgn (g x)
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)

goal (1 subgoal):
 1. \<And>x. 1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x) \<Longrightarrow> sgn (f x) = sgn (g x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
1 / 2 < sgn (if f x = 0 \<and> g x = 0 then 1 else f x / g x)

goal (1 subgoal):
 1. sgn (f x) = sgn (g x)
[PROOF STEP]
by (cases "f x" "0 :: real" rule: linorder_cases;
          cases "g x" "0 :: real" rule: linorder_cases) simp_all
[PROOF STATE]
proof (state)
this:
sgn (f x) = sgn (g x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. sgn (f x) = sgn (g x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_bilinear_sq_mtx_vec_mult: "bounded_bilinear (\<lambda>A s. A *\<^sub>V s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_bilinear (*\<^sub>V)
[PROOF STEP]
apply (rule bounded_bilinear.intro, simp_all add: mtx_vec_mult_add_rdistr
      mtx_vec_mult_add_rdistl scaleR_mtx_vec_assoc mtx_vec_scaleR_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>K. \<forall>a b. \<parallel>a *\<^sub>V b\<parallel> \<le> \<parallel>a\<parallel> * \<parallel>b\<parallel> * K
[PROOF STEP]
by (rule_tac x=1 in exI, auto intro!: norm_vec_mult_le)


[STATEMENT]
lemma gbinomial_partial_row_sum:
  "(\<Sum>k\<le>m. (a gchoose k) * ((a / 2) - of_nat k)) = ((of_nat m + 1)/2) * (a gchoose (m + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1))
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
 2. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
 2. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
case (Suc mm)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))
[PROOF STEP]
have "(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / 2 - of_nat k)) =
      (a - of_nat (Suc mm)) * (a gchoose Suc mm) / 2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
have "\<dots> = a * (a - 1 gchoose Suc mm) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)
[PROOF STEP]
by (subst gbinomial_absorb_comp) (rule refl)
[PROOF STATE]
proof (state)
this:
(a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
have "\<dots> = (of_nat (Suc mm) + 1) / 2 * (a gchoose (Suc mm + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a - (1::'a) gchoose Suc mm) / (2::'a) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
by (subst gbinomial_absorption [symmetric]) simp
[PROOF STATE]
proof (state)
this:
a * (a - (1::'a) gchoose Suc mm) / (2::'a) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_closed_segment_iff_rot:
  "x \<in> {a--b} \<longleftrightarrow> (x - a) \<bullet> rot (b - a) = 0 \<and> x \<bullet> (b - a) \<in> {a\<bullet>(b - a) .. b \<bullet> (b - a)}"
  if "a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {a--b}) = ((x - a) \<bullet> rot (b - a) = 0 \<and> x \<bullet> (b - a) \<in> {a \<bullet> (b - a)..b \<bullet> (b - a)})
[PROOF STEP]
unfolding closed_segment_line_hyperplanes[OF that]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> range (\<lambda>u. a + u *\<^sub>R (b - a)) \<inter> {x. a \<bullet> (b - a) \<le> x \<bullet> (b - a) \<and> x \<bullet> (b - a) \<le> b \<bullet> (b - a)}) = ((x - a) \<bullet> rot (b - a) = 0 \<and> x \<bullet> (b - a) \<in> {a \<bullet> (b - a)..b \<bullet> (b - a)})
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. (x \<in> range (\<lambda>u. a + u *\<^sub>R (b - a)) \<inter> {x. a \<bullet> (b - a) \<le> x \<bullet> (b - a) \<and> x \<bullet> (b - a) \<le> b \<bullet> (b - a)}) = ((x - a) \<bullet> rot (b - a) = 0 \<and> x \<bullet> (b - a) \<in> {a \<bullet> (b - a)..b \<bullet> (b - a)})
[PROOF STEP]
by (auto simp: nrm_dot intro!: inner_rot_in_segment)


[STATEMENT]
lemma Int_interval:
  fixes a :: "'a::euclidean_space"
  shows "cbox a b \<inter> cbox c d =
    cbox (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<inter> cbox c d = cbox (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i)
[PROOF STEP]
unfolding set_eq_iff and Int_iff and mem_box
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. ((\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i)) = (\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i) \<bullet> i)
[PROOF STEP]
by auto


[STATEMENT]
lemma mat_of_vec_mult_eq_scalar_prod:
  fixes v w :: "'a::conjugatable_field vec"
  assumes "v \<in> carrier_vec n" and "w \<in> carrier_vec n"
  shows "mat 1 (dim_vec v) (\<lambda>(i, j). (conjugate v) $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)
    = mat 1 1 (\<lambda>k. inner_prod v w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i) = mat 1 1 (\<lambda>k. inner_prod v w)
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat 1 1 (\<lambda>k. inner_prod v w)); j < dim_col (mat 1 1 (\<lambda>k. inner_prod v w))\<rbrakk> \<Longrightarrow> (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) $$ (i, j) = mat 1 1 (\<lambda>k. inner_prod v w) $$ (i, j)
 2. dim_row (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_row (mat 1 1 (\<lambda>k. inner_prod v w))
 3. dim_col (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_col (mat 1 1 (\<lambda>k. inner_prod v w))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (mat 1 1 (\<lambda>k. inner_prod v w)); j < dim_col (mat 1 1 (\<lambda>k. inner_prod v w))\<rbrakk> \<Longrightarrow> (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) $$ (i, j) = mat 1 1 (\<lambda>k. inner_prod v w) $$ (i, j)
 2. dim_row (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_row (mat 1 1 (\<lambda>k. inner_prod v w))
 3. dim_col (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_col (mat 1 1 (\<lambda>k. inner_prod v w))
[PROOF STEP]
apply (simp add: scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i = 0; j = 0; v \<in> carrier_vec n; w \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. conjugate (v $ i) * w $ i) = (\<Sum>i = 0..<n. w $ i * conjugate (v $ i))
 2. dim_row (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_row (mat 1 1 (\<lambda>k. inner_prod v w))
 3. dim_col (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_col (mat 1 1 (\<lambda>k. inner_prod v w))
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>i j. \<lbrakk>i = 0; j = 0; v \<in> carrier_vec n; w \<in> carrier_vec n\<rbrakk> \<Longrightarrow> {0..<n} = {0..<n}
 2. \<And>i j x. \<lbrakk>i = 0; j = 0; v \<in> carrier_vec n; w \<in> carrier_vec n; x \<in> {0..<n}\<rbrakk> \<Longrightarrow> conjugate (v $ x) * w $ x = w $ x * conjugate (v $ x)
 3. dim_row (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_row (mat 1 1 (\<lambda>k. inner_prod v w))
 4. dim_col (mat 1 (dim_vec v) (\<lambda>(i, j). conjugate v $ j) * mat (dim_vec w) 1 (\<lambda>(i, j). w $ i)) = dim_col (mat 1 1 (\<lambda>k. inner_prod v w))
[PROOF STEP]
by auto


[STATEMENT]
lemma Im_sin: "Im(sin z) = cos(Re z) * (exp(Im z) - exp(-(Im z))) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (sin z) = cos (Re z) * (exp (Im z) - exp (- Im z)) / 2
[PROOF STEP]
by (simp add: sin_exp_eq field_simps Im_divide Re_exp)


[STATEMENT]
lemma SET005_1:
 "(\<forall>Subset Element Superset. member(Element::'a,Subset) & subset(Subset::'a,Superset) --> member(Element::'a,Superset)) &
  (\<forall>Superset Subset. subset(Subset::'a,Superset) | member(member_of_1_not_of_2(Subset::'a,Superset),Subset)) &
  (\<forall>Subset Superset. member(member_of_1_not_of_2(Subset::'a,Superset),Superset) --> subset(Subset::'a,Superset)) &
  (\<forall>Subset Superset. equal_sets(Subset::'a,Superset) --> subset(Subset::'a,Superset)) &
  (\<forall>Subset Superset. equal_sets(Superset::'a,Subset) --> subset(Subset::'a,Superset)) &
  (\<forall>Set2 Set1. subset(Set1::'a,Set2) & subset(Set2::'a,Set1) --> equal_sets(Set2::'a,Set1)) &
  (\<forall>Set2 Intersection Element Set1. intersection(Set1::'a,Set2,Intersection) & member(Element::'a,Intersection) --> member(Element::'a,Set1)) &
  (\<forall>Set1 Intersection Element Set2. intersection(Set1::'a,Set2,Intersection) & member(Element::'a,Intersection) --> member(Element::'a,Set2)) &
  (\<forall>Set2 Set1 Element Intersection. intersection(Set1::'a,Set2,Intersection) & member(Element::'a,Set2) & member(Element::'a,Set1) --> member(Element::'a,Intersection)) &
  (\<forall>Set2 Intersection Set1. member(h(Set1::'a,Set2,Intersection),Intersection) | intersection(Set1::'a,Set2,Intersection) | member(h(Set1::'a,Set2,Intersection),Set1)) &
  (\<forall>Set1 Intersection Set2. member(h(Set1::'a,Set2,Intersection),Intersection) | intersection(Set1::'a,Set2,Intersection) | member(h(Set1::'a,Set2,Intersection),Set2)) &
  (\<forall>Set1 Set2 Intersection. member(h(Set1::'a,Set2,Intersection),Intersection) & member(h(Set1::'a,Set2,Intersection),Set2) & member(h(Set1::'a,Set2,Intersection),Set1) --> intersection(Set1::'a,Set2,Intersection)) &
  (intersection(a::'a,b,aIb)) &
  (intersection(b::'a,c,bIc)) &
  (intersection(a::'a,bIc,aIbIc)) &
  (~intersection(aIb::'a,c,aIbIc)) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>Subset Element Superset. member (Element, Subset) \<and> subset (Subset, Superset) \<longrightarrow> member (Element, Superset)) \<and> (\<forall>Superset Subset. subset (Subset, Superset) \<or> member (member_of_1_not_of_2 (Subset, Superset), Subset)) \<and> (\<forall>Subset Superset. member (member_of_1_not_of_2 (Subset, Superset), Superset) \<longrightarrow> subset (Subset, Superset)) \<and> (\<forall>Subset Superset. equal_sets (Subset, Superset) \<longrightarrow> subset (Subset, Superset)) \<and> (\<forall>Subset Superset. equal_sets (Superset, Subset) \<longrightarrow> subset (Subset, Superset)) \<and> (\<forall>Set2 Set1. subset (Set1, Set2) \<and> subset (Set2, Set1) \<longrightarrow> equal_sets (Set2, Set1)) \<and> (\<forall>Set2 Intersection Element Set1. intersection (Set1, Set2, Intersection) \<and> member (Element, Intersection) \<longrightarrow> member (Element, Set1)) \<and> (\<forall>Set1 Intersection Element Set2. intersection (Set1, Set2, Intersection) \<and> member (Element, Intersection) \<longrightarrow> member (Element, Set2)) \<and> (\<forall>Set2 Set1 Element Intersection. intersection (Set1, Set2, Intersection) \<and> member (Element, Set2) \<and> member (Element, Set1) \<longrightarrow> member (Element, Intersection)) \<and> (\<forall>Set2 Intersection Set1. member (h (Set1, Set2, Intersection), Intersection) \<or> intersection (Set1, Set2, Intersection) \<or> member (h (Set1, Set2, Intersection), Set1)) \<and> (\<forall>Set1 Intersection Set2. member (h (Set1, Set2, Intersection), Intersection) \<or> intersection (Set1, Set2, Intersection) \<or> member (h (Set1, Set2, Intersection), Set2)) \<and> (\<forall>Set1 Set2 Intersection. member (h (Set1, Set2, Intersection), Intersection) \<and> member (h (Set1, Set2, Intersection), Set2) \<and> member (h (Set1, Set2, Intersection), Set1) \<longrightarrow> intersection (Set1, Set2, Intersection)) \<and> intersection (a, b, aIb) \<and> intersection (b, c, bIc) \<and> intersection (a, bIc, aIbIc) \<and> \<not> intersection (aIb, c, aIbIc) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma image_image_mset: "image_mset (\<lambda> x . f x) (image_mset (\<lambda> y . g y) A) =
    image_mset (\<lambda> x. f (g x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f (image_mset g A) = {#f (g x). x \<in># A#}
[PROOF STEP]
by simp


[STATEMENT]
lemma "OAlist_tc_min_key_val (oalist_tc_of_list [(1, 3), (0::nat, 4::nat), (0, 2), (1, 1)]) = (0, 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OAlist_tc_min_key_val (oalist_tc_of_list [(1, 3), (0, 4), (0, 2), (1, 1)]) = (0, 4)
[PROOF STEP]
by eval


[STATEMENT]
lemma rotation_pi_2_y_axis [simp]:
  shows "moebius_circline (moebius_rotation (pi/2)) y_axis = x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_circline (moebius_rotation (pi / 2)) y_axis = x_axis
[PROOF STEP]
unfolding moebius_rotation_def moebius_similarity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_circline (mk_moebius (cis (pi / 2)) 0 0 1) y_axis = x_axis
[PROOF STEP]
by (transfer, transfer, simp add: mat_adj_def mat_cnj_def)


[STATEMENT]
lemma interval_is_sublattice: "\<lbrakk>a \<in> A; b \<in> A; interval r a b \<noteq> {}\<rbrakk> \<Longrightarrow> interval r a b <<= cl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; b \<in> A; interval r a b \<noteq> {}\<rbrakk> \<Longrightarrow> interval r a b <<= cl
[PROOF STEP]
apply (rule sublatticeI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> A; b \<in> A; interval r a b \<noteq> {}\<rbrakk> \<Longrightarrow> interval r a b \<subseteq> A
 2. \<lbrakk>a \<in> A; b \<in> A; interval r a b \<noteq> {}\<rbrakk> \<Longrightarrow> \<lparr>pset = interval r a b, order = induced (interval r a b) r\<rparr> \<in> CompleteLattice
[PROOF STEP]
apply (simp add: interval_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; b \<in> A; interval r a b \<noteq> {}\<rbrakk> \<Longrightarrow> \<lparr>pset = interval r a b, order = induced (interval r a b) r\<rparr> \<in> CompleteLattice
[PROOF STEP]
by (simp add: CompleteLatticeI intervalPO intv_CL_glb intv_CL_lub)


[STATEMENT]
lemma ipoly_add_rat_pos_neg:
  "ipoly (poly_add_rat r p) (x::'a::linordered_field) < 0 \<longleftrightarrow> ipoly p (x - of_rat r) < 0"
  "ipoly (poly_add_rat r p) (x::'a::linordered_field) > 0 \<longleftrightarrow> ipoly p (x - of_rat r) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (poly_add_rat r p) x < (0::'a)) = (ipoly p (x - of_rat r) < (0::'a)) &&& ((0::'a) < ipoly (poly_add_rat r p) x) = ((0::'a) < ipoly p (x - of_rat r))
[PROOF STEP]
using quotient_of_nonzero
[PROOF STATE]
proof (prove)
using this:
0 < snd (quotient_of ?r)
snd (quotient_of ?r) \<noteq> 0

goal (1 subgoal):
 1. (ipoly (poly_add_rat r p) x < (0::'a)) = (ipoly p (x - of_rat r) < (0::'a)) &&& ((0::'a) < ipoly (poly_add_rat r p) x) = ((0::'a) < ipoly p (x - of_rat r))
[PROOF STEP]
unfolding ipoly_add_rat
[PROOF STATE]
proof (prove)
using this:
0 < snd (quotient_of ?r)
snd (quotient_of ?r) \<noteq> 0

goal (1 subgoal):
 1. (of_int (snd (quotient_of r)) ^ degree p * ipoly p (x - of_rat r) < (0::'a)) = (ipoly p (x - of_rat r) < (0::'a)) &&& ((0::'a) < of_int (snd (quotient_of r)) ^ degree p * ipoly p (x - of_rat r)) = ((0::'a) < ipoly p (x - of_rat r))
[PROOF STEP]
by auto


[STATEMENT]
lemma dist_fs_triangle_infinite1:
  shows "1 / sqrt(1 + (cmod b)\<^sup>2) \<le> 1 / sqrt(1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt(1 + (cmod b)\<^sup>2) * sqrt(1 + (cmod c)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
let ?bb = "sqrt (1 + (cmod b)\<^sup>2)" and ?cc = "sqrt (1 + (cmod c)\<^sup>2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
have "?bb > 0" "?cc > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sqrt (1 + (cmod b)\<^sup>2) &&& 0 < sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by (metis add_strict_increasing real_sqrt_gt_0_iff zero_le_power2 zero_less_one)+
[PROOF STATE]
proof (state)
this:
0 < sqrt (1 + (cmod b)\<^sup>2)
0 < sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
hence *: "?bb * ?cc \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod b)\<^sup>2)
0 < sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. 0 \<le> sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
have **: "(?cc - ?bb) / (?bb * ?cc) = 1 / ?bb - 1 / ?cc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt (1 + (cmod c)\<^sup>2) - sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) = 1 / sqrt (1 + (cmod b)\<^sup>2) - 1 / sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
using \<open>sqrt (1 + (cmod b)\<^sup>2) > 0\<close>  \<open>sqrt (1 + (cmod c)\<^sup>2) > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < sqrt (1 + (cmod b)\<^sup>2)
0 < sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. (sqrt (1 + (cmod c)\<^sup>2) - sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) = 1 / sqrt (1 + (cmod b)\<^sup>2) - 1 / sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(sqrt (1 + (cmod c)\<^sup>2) - sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) = 1 / sqrt (1 + (cmod b)\<^sup>2) - 1 / sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
show "1 / ?bb \<le> 1 / ?cc + cmod (b - c) / (?bb * ?cc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
using divide_right_mono[OF cmod_diff_ge[of c b] *]
[PROOF STATE]
proof (prove)
using this:
(sqrt (1 + (cmod c)\<^sup>2) - sqrt (1 + (cmod b)\<^sup>2)) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2)) \<le> cmod (c - b) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. 1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (subst (asm) **) (simp add: field_simps norm_minus_commute)
[PROOF STATE]
proof (state)
this:
1 / sqrt (1 + (cmod b)\<^sup>2) \<le> 1 / sqrt (1 + (cmod c)\<^sup>2) + cmod (b - c) / (sqrt (1 + (cmod b)\<^sup>2) * sqrt (1 + (cmod c)\<^sup>2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_right_to_top:
  "eventually P (at_right (0::real)) \<longleftrightarrow> eventually (\<lambda>x. P (inverse x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right 0) = (\<forall>\<^sub>F x in at_top. P (inverse x))
[PROOF STEP]
unfolding at_right_to_top eventually_filtermap
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in at_top. P (inverse x)) = (\<forall>\<^sub>F x in at_top. P (inverse x))
[PROOF STEP]
..


[STATEMENT]
lemma union_interior_of_subset:
   "X interior_of S \<union> X interior_of T \<subseteq> X interior_of (S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X interior_of S \<union> X interior_of T \<subseteq> X interior_of (S \<union> T)
[PROOF STEP]
by (simp add: interior_of_mono)


[STATEMENT]
lemma coprime_iff_invertible'_int:
  fixes m :: int
  assumes "m > 0"
  shows "coprime a m \<longleftrightarrow> (\<exists>x. 0 \<le> x \<and> x < m \<and> [a * x = 1] (mod m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = 1] (mod m))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. coprime a m = (\<exists>x\<ge>0. x < m \<and> [a * x = 1] (mod m))
[PROOF STEP]
by (simp add: coprime_iff_invertible_int)
    (metis assms cong_mod_left mod_mult_right_eq pos_mod_bound pos_mod_sign)


[STATEMENT]
lemma unlr_inf: "unlr (inf x y) = unlr x \<inter> unlr y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unlr (inf x y) = unlr x \<inter> unlr y
[PROOF STEP]
unfolding inf_admS_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unlr (mklr (unlr x \<inter> unlr y)) = unlr x \<inter> unlr y
[PROOF STEP]
by (simp add: admS_def)


[STATEMENT]
lemma fset_le_singleton_iff: "(fset X \<subseteq> {x}) = (X = {||} \<or> X = {|x|})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fset X \<subseteq> {x}) = (X = {||} \<or> X = {|x|})
[PROOF STEP]
by (metis finsert.rep_eq fset_eq_empty_iff fset_inject order_refl singleton_insert_inj_eq subset_singletonD)


[STATEMENT]
lemma mat_mod_count_row_eq:  "i < dim_row M \<Longrightarrow> elements_mat M \<subseteq> {0..<m} \<Longrightarrow>
    count_vec (row (mat_mod M) i) x = count_vec (row M i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row M; elements_mat M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> count_vec (row (local.mat_mod M) i) x = count_vec (row M i) x
[PROOF STEP]
using count_vec_mod_eq mat_mod_vec_mod_row elems_mat_setv_row_0m
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v ?v \<subseteq> {0..<m} \<Longrightarrow> count_vec ?v ?x = count_vec (vec_mod ?v) ?x
?i < dim_row ?A \<Longrightarrow> row (local.mat_mod ?A) ?i = vec_mod (row ?A ?i)
\<lbrakk>?i < dim_row ?M; elements_mat ?M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> set\<^sub>v (row ?M ?i) \<subseteq> {0..<m}

goal (1 subgoal):
 1. \<lbrakk>i < dim_row M; elements_mat M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> count_vec (row (local.mat_mod M) i) x = count_vec (row M i) x
[PROOF STEP]
by simp


[STATEMENT]
lemma vec_of_ell2_ket[code]:
  \<comment> \<open>Code equation for computing a standard basis vector\<close>
  "vec_of_ell2 (ket i) = unit_vec (CARD('a)) (enum_idx i)"
  for i::"'a::enum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_ell2 (ket i) = unit_vec CARD('a) (enum_idx i)
[PROOF STEP]
using vec_of_ell2_def vec_of_basis_enum_ket
[PROOF STATE]
proof (prove)
using this:
vec_of_ell2 = vec_of_basis_enum
vec_of_basis_enum (ket ?i) = unit_vec CARD(?'a) (enum_idx ?i)

goal (1 subgoal):
 1. vec_of_ell2 (ket i) = unit_vec CARD('a) (enum_idx i)
[PROOF STEP]
by metis


[STATEMENT]
lemma linear_surj_right_inverse:
  assumes lf: "linear s1 s2 f"
  assumes sf: "vs2.span T \<subseteq> f`vs1.span S"
  shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)
[PROOF STEP]
using linear_exists_right_inverse_on[OF lf vs1.subspace_span, of S] sf
[PROOF STATE]
proof (prove)
using this:
\<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>v\<in>f ` vs1.span S. f (g v) = v)
vs2.span T \<subseteq> f ` vs1.span S

goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)
[PROOF STEP]
by (force simp: linear_iff_module_hom)


[STATEMENT]
lemma rel_fset_alt_def: "rel_fset R = (\<lambda>A B. (\<forall>x.\<exists>y. x|\<in>|A \<longrightarrow> y|\<in>|B \<and> R x y)
  \<and> (\<forall>y. \<exists>x. y|\<in>|B \<longrightarrow> x|\<in>|A \<and> R x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_fset R = (\<lambda>A B. (\<forall>x. \<exists>y. x |\<in>| A \<longrightarrow> y |\<in>| B \<and> R x y) \<and> (\<forall>y. \<exists>x. y |\<in>| B \<longrightarrow> x |\<in>| A \<and> R x y))
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B. rel_fset R A B = ((\<forall>x. \<exists>y. x |\<in>| A \<longrightarrow> y |\<in>| B \<and> R x y) \<and> (\<forall>y. \<exists>x. y |\<in>| B \<longrightarrow> x |\<in>| A \<and> R x y))
[PROOF STEP]
apply transfer'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B R. rel_set R A B = ((\<forall>x. \<exists>y. x \<in> A \<longrightarrow> y \<in> B \<and> R x y) \<and> (\<forall>y. \<exists>x. y \<in> B \<longrightarrow> x \<in> A \<and> R x y))
[PROOF STEP]
apply (subst rel_set_def[unfolded fun_eq_iff])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B R. ((\<forall>x\<in>A. Bex B (R x)) \<and> (\<forall>y\<in>B. \<exists>x\<in>A. R x y)) = ((\<forall>x. \<exists>y. x \<in> A \<longrightarrow> y \<in> B \<and> R x y) \<and> (\<forall>y. \<exists>x. y \<in> B \<longrightarrow> x \<in> A \<and> R x y))
[PROOF STEP]
by blast


[STATEMENT]
lemma AE_finite_allI:
  assumes "finite S"
  shows "(\<And>s. s \<in> S \<Longrightarrow> AE x in M. Q s x) \<Longrightarrow> AE x in M. \<forall>s\<in>S. Q s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in> S \<Longrightarrow> almost_everywhere M (Q s)) \<Longrightarrow> AE x in M. \<forall>s\<in>S. Q s x
[PROOF STEP]
using AE_finite_all[OF \<open>finite S\<close>]
[PROOF STATE]
proof (prove)
using this:
(AE x in ?M. \<forall>i\<in>S. ?P i x) = (\<forall>i\<in>S. almost_everywhere ?M (?P i))

goal (1 subgoal):
 1. (\<And>s. s \<in> S \<Longrightarrow> almost_everywhere M (Q s)) \<Longrightarrow> AE x in M. \<forall>s\<in>S. Q s x
[PROOF STEP]
by auto


[STATEMENT]
lemma Node_in_trees_iff[simp]: "Node l v r \<in> trees S \<longleftrightarrow> (l \<in> trees S \<and> v \<in> S \<and> r \<in> trees S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<langle>l, v, r\<rangle> \<in> trees S) = (l \<in> trees S \<and> v \<in> S \<and> r \<in> trees S)
[PROOF STEP]
by (subst trees.simps) auto


[STATEMENT]
lemma card_verts: "card (verts H) = card (verts G) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (verts H) = card (verts G) + 1
[PROOF STEP]
unfolding verts_H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (verts G \<union> {w}) = card (verts G) + 1
[PROOF STEP]
using not_in_verts_G
[PROOF STATE]
proof (prove)
using this:
w \<notin> verts G

goal (1 subgoal):
 1. card (verts G \<union> {w}) = card (verts G) + 1
[PROOF STEP]
by auto


[STATEMENT]
lemma prob_conj_imp1:
  "prob ({x. Q x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob ({x. Q x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0
[PROOF STEP]
using finite_measure_mono[of "{x. Pr x \<and> Q x} \<inter> msgs" "{x. Q x} \<inter> msgs"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{x. Pr x \<and> Q x} \<inter> msgs \<subseteq> {x. Q x} \<inter> msgs; {x. Q x} \<inter> msgs \<in> events\<rbrakk> \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) \<le> prob ({x. Q x} \<inter> msgs)

goal (1 subgoal):
 1. prob ({x. Q x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0
[PROOF STEP]
using measure_nonneg[of \<mu> "{x. Pr x \<and> Q x} \<inter> msgs"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{x. Pr x \<and> Q x} \<inter> msgs \<subseteq> {x. Q x} \<inter> msgs; {x. Q x} \<inter> msgs \<in> events\<rbrakk> \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) \<le> prob ({x. Q x} \<inter> msgs)
0 \<le> prob ({x. Pr x \<and> Q x} \<inter> msgs)

goal (1 subgoal):
 1. prob ({x. Q x} \<inter> msgs) = 0 \<Longrightarrow> prob ({x. Pr x \<and> Q x} \<inter> msgs) = 0
[PROOF STEP]
by (simp add: subset_eq)


[STATEMENT]
lemma Log_le_cancel_iff [simp]:
     "\<lbrakk> 1 < a; 0 < x; 0 < y \<rbrakk> \<Longrightarrow> (Log a x \<le> Log a y) = (x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> (Log a x \<le> Log a y) = (x \<le> y)
[PROOF STEP]
by (simp add: linorder_not_less [symmetric])


[STATEMENT]
lemma "3 ^ 15 = (14348907::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 ^ 15 = 14348907
[PROOF STEP]
by simp


[STATEMENT]
theorem "\<And>(y::int) (z::int) (n::int). 3 dvd z \<Longrightarrow> 2 dvd (y::int) \<Longrightarrow>
    (\<exists>(x::int). 2*x = y) \<and> (\<exists>(k::int). 3*k = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z n. \<lbrakk>3 dvd z; even y\<rbrakk> \<Longrightarrow> (\<exists>x. 2 * x = y) \<and> (\<exists>k. 3 * k = z)
[PROOF STEP]
by cooper


[STATEMENT]
lemma (in finite_measure) finite_measure_subadditive_finite:
  assumes "finite I" "A`I \<subseteq> sets M" shows "measure M (\<Union>i\<in>I. A i) \<le> (\<Sum>i\<in>I. measure M (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (A ` I)) \<le> (\<Sum>i\<in>I. Sigma_Algebra.measure M (A i))
[PROOF STEP]
using measure_subadditive_finite[OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> I \<Longrightarrow> emeasure M (A i) \<noteq> \<infinity>) \<Longrightarrow> Sigma_Algebra.measure M (\<Union> (A ` I)) \<le> (\<Sum>i\<in>I. Sigma_Algebra.measure M (A i))

goal (1 subgoal):
 1. Sigma_Algebra.measure M (\<Union> (A ` I)) \<le> (\<Sum>i\<in>I. Sigma_Algebra.measure M (A i))
[PROOF STEP]
by simp


[STATEMENT]
lemma "(\<lambda>x::real. (root 3 x - 1) / (sqrt x - 1)) \<midarrow>1\<rightarrow> 2/3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (root 3 x - 1) / (sqrt x - 1)) \<midarrow>1\<rightarrow> 2 / 3
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma RDirProd_iso1:
  "(\<lambda>(x, y). (y, x)) \<in> ring_iso (RDirProd R S) (RDirProd S R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (y, x)) \<in> ring_iso (RDirProd R S) (RDirProd S R)
[PROOF STEP]
unfolding ring_iso_def ring_hom_def bij_betw_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (y, x)) \<in> {h \<in> {h \<in> carrier (RDirProd R S) \<rightarrow> carrier (RDirProd S R). (\<forall>x y. x \<in> carrier (RDirProd R S) \<and> y \<in> carrier (RDirProd R S) \<longrightarrow> h (x \<otimes>\<^bsub>RDirProd R S\<^esub> y) = h x \<otimes>\<^bsub>RDirProd S R\<^esub> h y \<and> h (x \<oplus>\<^bsub>RDirProd R S\<^esub> y) = h x \<oplus>\<^bsub>RDirProd S R\<^esub> h y) \<and> h \<one>\<^bsub>RDirProd R S\<^esub> = \<one>\<^bsub>RDirProd S R\<^esub>}. (\<forall>x\<in>carrier (RDirProd R S). \<forall>y\<in>carrier (RDirProd R S). h x = h y \<longrightarrow> x = y) \<and> h ` carrier (RDirProd R S) = carrier (RDirProd S R)}
[PROOF STEP]
by (auto simp add: RDirProd_def DirProd_def monoid.defs)