[STATEMENT]
lemma row_vec_mat_Tensor_prelim:
 "\<forall>i.
     ((i < (length v)*(row_length M))\<and>(mat nr (length M) M)
      \<longrightarrow> row (vec_mat_Tensor v M) i
            = times (v!(i div row_length M)) (row M (i mod row_length M)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))
[PROOF STEP]
apply(rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))
[PROOF STEP]
proof(induct M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < length v * row_length [] \<and> mat nr (length []) [] \<longrightarrow> row (vec_mat_Tensor v []) i = local.times (v ! (i div row_length [])) (row [] (i mod row_length []))
 2. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>i. i < length v * row_length [] \<and> mat nr (length []) [] \<longrightarrow> row (vec_mat_Tensor v []) i = local.times (v ! (i div row_length [])) (row [] (i mod row_length []))
 2. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length v * row_length [] \<and> mat nr (length []) [] \<longrightarrow> row (vec_mat_Tensor v []) i = local.times (v ! (i div row_length [])) (row [] (i mod row_length []))
[PROOF STEP]
using Nil
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length v * row_length [] \<and> mat nr (length []) [] \<longrightarrow> row (vec_mat_Tensor v []) i = local.times (v ! (i div row_length [])) (row [] (i mod row_length []))
[PROOF STEP]
by (metis less_nat_zero_code mult_0_right row_length_Nil)
[PROOF STATE]
proof (state)
this:
i < length v * row_length [] \<and> mat nr (length []) [] \<longrightarrow> row (vec_mat_Tensor v []) i = local.times (v ! (i div row_length [])) (row [] (i mod row_length []))

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
case (Cons w N)
[PROOF STATE]
proof (state)
this:
?i < length v * row_length N \<and> mat nr (length N) N \<longrightarrow> row (vec_mat_Tensor v N) ?i = local.times (v ! (?i div row_length N)) (row N (?i mod row_length N))

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
have "row (vec_mat_Tensor v (w#N)) i
                      =  row ((vec_vec_Tensor v w)#(vec_mat_Tensor v N)) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i
[PROOF STEP]
using vec_mat_Tensor.simps
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor ?xs [] = []
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i
[PROOF STEP]
have 1:"...   = ((vec_vec_Tensor v w)!i)#(row (vec_mat_Tensor v N) i)"
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i

goal (1 subgoal):
 1. row (vec_vec_Tensor v w # vec_mat_Tensor v N) i = vec_vec_Tensor v w ! i # row (vec_mat_Tensor v N) i
[PROOF STEP]
using row_Cons
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v (w # N)) i = row (vec_vec_Tensor v w # vec_mat_Tensor v N) i
row (?v # ?M) ?i = ?v ! ?i # row ?M ?i

goal (1 subgoal):
 1. row (vec_vec_Tensor v w # vec_mat_Tensor v N) i = vec_vec_Tensor v w ! i # row (vec_mat_Tensor v N) i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (vec_vec_Tensor v w # vec_mat_Tensor v N) i = vec_vec_Tensor v w ! i # row (vec_mat_Tensor v N) i

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
have 2:"row_length (w#N) = length w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (w # N) = length w
[PROOF STEP]
using row_length_def
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. row_length (w # N) = length w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (w # N) = length w

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row_length (w # N) = length w
[PROOF STEP]
have 3:"(mat nr (length (w#N)) (w#N)) \<Longrightarrow> nr = length w"
[PROOF STATE]
proof (prove)
using this:
row_length (w # N) = length w

goal (1 subgoal):
 1. mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
[PROOF STEP]
using hd_in_set list.distinct(1) mat_uniqueness matrix_row_length
[PROOF STATE]
proof (prove)
using this:
row_length (w # N) = length w
?xs \<noteq> [] \<Longrightarrow> hd ?xs \<in> set ?xs
[] \<noteq> ?x21.0 # ?x22.0
\<lbrakk>mat ?nr1.0 ?nc ?M; mat ?nr2.0 ?nc ?M; ?z = hd ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> \<forall>x\<in>set ?M. ?nr1.0 = ?nr2.0
mat ?nr ?nc ?M \<Longrightarrow> mat (row_length ?M) (length ?M) ?M

goal (1 subgoal):
 1. mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
[PROOF STEP]
have   "((i < (length v)*(row_length (w#N)))
               \<and> (mat nr (length (w#N)) (w#N))
                 \<Longrightarrow> row (vec_mat_Tensor v (w#N)) i
                           = times
                                 (v!(i div row_length (w#N)))
                                 (row (w#N) (i mod row_length (w#N))))"
[PROOF STATE]
proof (prove)
using this:
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w

goal (1 subgoal):
 1. i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N); mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
assume assms: "i < (length v)*(row_length (w#N))
                     \<and> (mat nr (length (w#N)) (w#N))"
[PROOF STATE]
proof (state)
this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)

goal (1 subgoal):
 1. \<lbrakk>i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N); mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
proof(cases N)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. N = [] \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
N = []

goal (2 subgoals):
 1. N = [] \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have "row (vec_mat_Tensor v (w#N)) i = [(vec_vec_Tensor v w)!i]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]
[PROOF STEP]
using 1 vec_mat_Tensor.simps  Nil row_empty
[PROOF STATE]
proof (prove)
using this:
row (vec_vec_Tensor v w # vec_mat_Tensor v N) i = vec_vec_Tensor v w ! i # row (vec_mat_Tensor v N) i
vec_mat_Tensor ?xs [] = []
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss
N = []
row [] ?i = []

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]

goal (2 subgoals):
 1. N = [] \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
proof(cases w)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
w = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have "(vec_vec_Tensor v w) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_vec_Tensor v w = []
[PROOF STEP]
using Nil vec_vec_Tensor_right_empty
[PROOF STATE]
proof (prove)
using this:
w = []
vec_vec_Tensor ?x [] = []

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

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor v w = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have " (length v)*(row_length (w#N)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v * row_length (w # N) = 0
[PROOF STEP]
using Nil row_length_def
[PROOF STATE]
proof (prove)
using this:
w = []
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. length v * row_length (w # N) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v * row_length (w # N) = 0

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v * row_length (w # N) = 0
[PROOF STEP]
have " [(vec_vec_Tensor v [])!i] = []"
[PROOF STATE]
proof (prove)
using this:
length v * row_length (w # N) = 0

goal (1 subgoal):
 1. [vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
using assms less_nat_zero_code
[PROOF STATE]
proof (prove)
using this:
length v * row_length (w # N) = 0
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
(?n < 0) = False

goal (1 subgoal):
 1. [vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
[vec_vec_Tensor v [] ! i] = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
using vec_vec_Tensor.simps row_empty Nil assms list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []
vec_vec_Tensor [] ?ys = []
vec_vec_Tensor (?x # ?xs) ?ys = local.times ?x ?ys @ vec_vec_Tensor ?xs ?ys
row [] ?i = []
w = []
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case (Cons a w1)
[PROOF STATE]
proof (state)
this:
w = a # w1

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have 1:"w \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> []
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
w = a # w1

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

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w \<noteq> []
[PROOF STEP]
have "i < (length v)*(length w)"
[PROOF STATE]
proof (prove)
using this:
w \<noteq> []

goal (1 subgoal):
 1. i < length v * length w
[PROOF STEP]
using assms row_length_def
[PROOF STATE]
proof (prove)
using this:
w \<noteq> []
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. i < length v * length w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length v * length w

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length v * length w
[PROOF STEP]
have "(vec_vec_Tensor v w)!i
                                       = f
                                           (v!(i div (length w)))
                                           (w!(i mod (length w)))"
[PROOF STATE]
proof (prove)
using this:
i < length v * length w

goal (1 subgoal):
 1. vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
[PROOF STEP]
using vec_vec_Tensor_elements 1 allI
[PROOF STATE]
proof (prove)
using this:
i < length v * length w
?y \<noteq> [] \<Longrightarrow> \<forall>i<length ?x * length ?y. vec_vec_Tensor ?x ?y ! i = ?x ! (i div length ?y) * ?y ! (i mod length ?y)
w \<noteq> []
(\<And>x. ?P x) \<Longrightarrow> \<forall>x. ?P x

goal (1 subgoal):
 1. vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
[PROOF STEP]
have "(row (vec_mat_Tensor v (w#N)) i)
                                = times
                                      (v!(i div row_length (w#N)))
                                      (row (w#N) (i mod (length w)))"
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))
[PROOF STEP]
using Cons vec_mat_Tensor.simps row_def  row_length_def 2 Nil row_Cons
                   row_empty times.simps(1) times.simps(2)
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
w = a # w1
vec_mat_Tensor ?xs [] = []
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss
row ?m ?i \<equiv> map (\<lambda>w. w ! ?i) ?m
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
row_length (w # N) = length w
N = []
row (?v # ?M) ?i = ?v ! ?i # row ?M ?i
row [] ?i = []
local.times ?n [] = []
local.times ?n (?y # ?ys) = (?n * ?y) # local.times ?n ?ys

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v (w # N)) i = [vec_vec_Tensor v w ! i]; w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
using row_def 2
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod length w))
row ?m ?i \<equiv> map (\<lambda>w. w ! ?i) ?m
row_length (w # N) = length w

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case (Cons w1 N1)
[PROOF STATE]
proof (state)
this:
N = w1 # N1

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have Cons_0:"row_length N = length w1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length N = length w1
[PROOF STEP]
using Cons row_length_def
[PROOF STATE]
proof (prove)
using this:
N = w1 # N1
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. row_length N = length w1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length N = length w1

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have "mat nr (length (w#w1#N1)) (w#w1#N1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat nr (length (w # w1 # N1)) (w # w1 # N1)
[PROOF STEP]
using assms Cons
[PROOF STATE]
proof (prove)
using this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
N = w1 # N1

goal (1 subgoal):
 1. mat nr (length (w # w1 # N1)) (w # w1 # N1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat nr (length (w # w1 # N1)) (w # w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat nr (length (w # w1 # N1)) (w # w1 # N1)
[PROOF STEP]
have Cons_1:
                     "mat (row_length (w#w1#N1)) (length (w#w1#N1)) (w#w1#N1)"
[PROOF STATE]
proof (prove)
using this:
mat nr (length (w # w1 # N1)) (w # w1 # N1)

goal (1 subgoal):
 1. mat (row_length (w # w1 # N1)) (length (w # w1 # N1)) (w # w1 # N1)
[PROOF STEP]
by (metis matrix_row_length)
[PROOF STATE]
proof (state)
this:
mat (row_length (w # w1 # N1)) (length (w # w1 # N1)) (w # w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (w # w1 # N1)) (length (w # w1 # N1)) (w # w1 # N1)
[PROOF STEP]
have Cons_2:
                     "mat (row_length (w1#N1)) (length (w1#N1)) (w1#N1)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (w # w1 # N1)) (length (w # w1 # N1)) (w # w1 # N1)

goal (1 subgoal):
 1. mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)
[PROOF STEP]
by (metis reduct_matrix)
[PROOF STATE]
proof (state)
this:
mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)
[PROOF STEP]
have Cons_3:"(length w1 = length w)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)

goal (1 subgoal):
 1. length w1 = length w
[PROOF STEP]
using Cons_1
[PROOF STATE]
proof (prove)
using this:
mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)
mat (row_length (w # w1 # N1)) (length (w # w1 # N1)) (w # w1 # N1)

goal (1 subgoal):
 1. length w1 = length w
[PROOF STEP]
unfolding mat_def row_length_def Ball_def vec_def
[PROOF STATE]
proof (prove)
using this:
length (w1 # N1) = length (w1 # N1) \<and> (\<forall>x. x \<in> set (w1 # N1) \<longrightarrow> length x = (if w1 # N1 = [] then 0 else length (hd (w1 # N1))))
length (w # w1 # N1) = length (w # w1 # N1) \<and> (\<forall>x. x \<in> set (w # w1 # N1) \<longrightarrow> length x = (if w # w1 # N1 = [] then 0 else length (hd (w # w1 # N1))))

goal (1 subgoal):
 1. length w1 = length w
[PROOF STEP]
by (metis "2" Cons_0 Cons_1 local.Cons row_length_eq)
[PROOF STATE]
proof (state)
this:
length w1 = length w

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length w1 = length w
[PROOF STEP]
have Cons_4:"mat nr (length (w1#N1)) (w1#N1)"
[PROOF STATE]
proof (prove)
using this:
length w1 = length w

goal (1 subgoal):
 1. mat nr (length (w1 # N1)) (w1 # N1)
[PROOF STEP]
using 3 Cons_2 assms hd_conv_nth list.distinct(1) nth_Cons_0 row_length_def
[PROOF STATE]
proof (prove)
using this:
length w1 = length w
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
mat (row_length (w1 # N1)) (length (w1 # N1)) (w1 # N1)
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
?xs \<noteq> [] \<Longrightarrow> hd ?xs = ?xs ! 0
[] \<noteq> ?x21.0 # ?x22.0
(?x # ?xs) ! 0 = ?x
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. mat nr (length (w1 # N1)) (w1 # N1)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat nr (length (w1 # N1)) (w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat nr (length (w1 # N1)) (w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have "i < (length v)*(row_length (w1#N1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length v * row_length (w1 # N1)
[PROOF STEP]
using assms Cons_3 row_length_def
[PROOF STATE]
proof (prove)
using this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
length w1 = length w
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. i < length v * row_length (w1 # N1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length v * row_length (w1 # N1)

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat nr (length (w1 # N1)) (w1 # N1)
i < length v * row_length (w1 # N1)
[PROOF STEP]
have Cons_5:"row (vec_mat_Tensor v N) i
                                  = times
                                      (v ! (i div row_length N))
                                      (row N (i mod row_length N))"
[PROOF STATE]
proof (prove)
using this:
mat nr (length (w1 # N1)) (w1 # N1)
i < length v * row_length (w1 # N1)

goal (1 subgoal):
 1. row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
using Cons  Cons.hyps
[PROOF STATE]
proof (prove)
using this:
mat nr (length (w1 # N1)) (w1 # N1)
i < length v * row_length (w1 # N1)
N = w1 # N1
?i < length v * row_length N \<and> mat nr (length N) N \<longrightarrow> row (vec_mat_Tensor v N) ?i = local.times (v ! (?i div row_length N)) (row N (?i mod row_length N))

goal (1 subgoal):
 1. row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. \<And>a list. N = a # list \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
proof(cases w)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
w = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have "(vec_vec_Tensor v w) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_vec_Tensor v w = []
[PROOF STEP]
using Nil vec_vec_Tensor_right_empty
[PROOF STATE]
proof (prove)
using this:
w = []
vec_vec_Tensor ?x [] = []

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

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor v w = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have " (length v)*(row_length (w#N)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length v * row_length (w # N) = 0
[PROOF STEP]
using Nil row_length_def
[PROOF STATE]
proof (prove)
using this:
w = []
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. length v * row_length (w # N) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length v * row_length (w # N) = 0

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length v * row_length (w # N) = 0
[PROOF STEP]
have " [(vec_vec_Tensor v [])!i] = []"
[PROOF STATE]
proof (prove)
using this:
length v * row_length (w # N) = 0

goal (1 subgoal):
 1. [vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length v * row_length (w # N) = 0
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)

goal (1 subgoal):
 1. [vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
by (metis less_nat_zero_code)
[PROOF STATE]
proof (state)
this:
[vec_vec_Tensor v [] ! i] = []

goal (2 subgoals):
 1. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = []\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
 2. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
using vec_vec_Tensor.simps row_empty Nil assms
[PROOF STATE]
proof (prove)
using this:
vec_vec_Tensor v w = []
[vec_vec_Tensor v [] ! i] = []
vec_vec_Tensor [] ?ys = []
vec_vec_Tensor (?x # ?xs) ?ys = local.times ?x ?ys @ vec_vec_Tensor ?xs ?ys
row [] ?i = []
w = []
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
by (metis list.distinct(1))
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
case (Cons a w2)
[PROOF STATE]
proof (state)
this:
w = a # w2

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have 1:"w \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<noteq> []
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
w = a # w2

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

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w \<noteq> []
[PROOF STEP]
have "i < (length v)*(length w)"
[PROOF STATE]
proof (prove)
using this:
w \<noteq> []

goal (1 subgoal):
 1. i < length v * length w
[PROOF STEP]
using assms row_length_def
[PROOF STATE]
proof (prove)
using this:
w \<noteq> []
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. i < length v * length w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length v * length w

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length v * length w
[PROOF STEP]
have ConsCons_2:
                     "(vec_vec_Tensor v w)!i = f
                                                 (v!(i div (length w)))
                                                 (w!(i mod (length w)))"
[PROOF STATE]
proof (prove)
using this:
i < length v * length w

goal (1 subgoal):
 1. vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
[PROOF STEP]
using vec_vec_Tensor_elements 1 allI
[PROOF STATE]
proof (prove)
using this:
i < length v * length w
?y \<noteq> [] \<Longrightarrow> \<forall>i<length ?x * length ?y. vec_vec_Tensor ?x ?y ! i = ?x ! (i div length ?y) * ?y ! (i mod length ?y)
w \<noteq> []
(\<And>x. ?P x) \<Longrightarrow> \<forall>x. ?P x

goal (1 subgoal):
 1. vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
have
                      "times
                              (v!(i div row_length (w#N)))
                              (row (w#N) (i mod row_length (w#N)))
                             = (f
                                 (v!(i div (length w)))
                                 (w!(i mod (length w))))
                                  #(times (v ! (i div row_length N))
                                          (row N (i mod row_length N)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
have temp:"row_length (w#N) = (row_length N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length (w # N) = row_length N
[PROOF STEP]
using row_length_def 2 Cons_3 Cons_0
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
row_length (w # N) = length w
length w1 = length w
row_length N = length w1

goal (1 subgoal):
 1. row_length (w # N) = row_length N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length (w # N) = row_length N

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
have "(row (w#N) (i mod row_length (w#N)))
                              = (w!(i mod (row_length (w#N))))
                                       #(row N (i mod row_length (w#N)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (w # N) (i mod row_length (w # N)) = w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N))
[PROOF STEP]
unfolding row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>wa. wa ! (i mod row_length (w # N))) (w # N) = w ! (i mod row_length (w # N)) # map (\<lambda>wa. wa ! (i mod row_length (w # N))) N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (w # N) (i mod row_length (w # N)) = w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N))

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row (w # N) (i mod row_length (w # N)) = w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N))
[PROOF STEP]
have "...
                              = (w!(i mod (length w)))
                                        #(row N (i mod row_length N))"
[PROOF STATE]
proof (prove)
using this:
row (w # N) (i mod row_length (w # N)) = w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N))

goal (1 subgoal):
 1. w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N)) = w ! (i mod length w) # row N (i mod row_length N)
[PROOF STEP]
using Cons_3 3 assms 2 neq_Nil_conv row_Cons row_empty
                           row_length_eq
[PROOF STATE]
proof (prove)
using this:
row (w # N) (i mod row_length (w # N)) = w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N))
length w1 = length w
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
row_length (w # N) = length w
(?xs \<noteq> []) = (\<exists>y ys. ?xs = y # ys)
row (?v # ?M) ?i = ?v ! ?i # row ?M ?i
row [] ?i = []
mat (row_length (?a # ?b # ?N)) (length (?a # ?b # ?N)) (?a # ?b # ?N) \<longrightarrow> row_length (?a # ?b # ?N) = row_length (?b # ?N)

goal (1 subgoal):
 1. w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N)) = w ! (i mod length w) # row N (i mod row_length N)
[PROOF STEP]
by (metis (opaque_lifting, no_types))
[PROOF STATE]
proof (state)
this:
w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N)) = w ! (i mod length w) # row N (i mod row_length N)

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N)) = w ! (i mod length w) # row N (i mod row_length N)
[PROOF STEP]
have "times
                           (v!(i div row_length (w#N)))
                           ((w!(i mod (length w)))
                             #(row N (i mod row_length N)))
                               = (f
                                     (v!(i div row_length (w#N)))
                                     (w!(i mod (length w))))
                                         #(times  (v!(i div row_length (w#N)))
                                                      (row N (i mod row_length N)))"
[PROOF STATE]
proof (prove)
using this:
w ! (i mod row_length (w # N)) # row N (i mod row_length (w # N)) = w ! (i mod length w) # row N (i mod row_length N)

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (w ! (i mod length w) # row N (i mod row_length N)) = (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.times (v ! (i div row_length (w # N))) (w ! (i mod length w) # row N (i mod row_length N)) = (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N))

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.times (v ! (i div row_length (w # N))) (w ! (i mod length w) # row N (i mod row_length N)) = (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N))
[PROOF STEP]
have "... =  (f
                                       (v!(i div length w))
                                       (w!(i mod (length w))))
                                         #(times  (v!(i div row_length N))
                                                  (row N (i mod row_length N)))"
[PROOF STATE]
proof (prove)
using this:
local.times (v ! (i div row_length (w # N))) (w ! (i mod length w) # row N (i mod row_length N)) = (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N))

goal (1 subgoal):
 1. (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
using 3 Cons_3 assms temp row_length_def
[PROOF STATE]
proof (prove)
using this:
local.times (v ! (i div row_length (w # N))) (w ! (i mod length w) # row N (i mod row_length N)) = (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N))
mat nr (length (w # N)) (w # N) \<Longrightarrow> nr = length w
length w1 = length w
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N)
row_length (w # N) = row_length N
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)

goal (1 subgoal):
 1. (v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
using times.simps 2 row_Cons temp
[PROOF STATE]
proof (prove)
using this:
(v ! (i div row_length (w # N)) * w ! (i mod length w)) # local.times (v ! (i div row_length (w # N))) (row N (i mod row_length N)) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
local.times ?n [] = []
local.times ?n (?y # ?ys) = (?n * ?y) # local.times ?n ?ys
row_length (w # N) = length w
row (?v # ?M) ?i = ?v ! ?i # row ?M ?i
row_length (w # N) = row_length N

goal (1 subgoal):
 1. local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N)); w = a # list\<rbrakk> \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
using Cons_5 ConsCons_2 1
                                row_Cons vec_mat_Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N))) = (v ! (i div length w) * w ! (i mod length w)) # local.times (v ! (i div row_length N)) (row N (i mod row_length N))
row (vec_mat_Tensor v N) i = local.times (v ! (i div row_length N)) (row N (i mod row_length N))
vec_vec_Tensor v w ! i = v ! (i div length w) * w ! (i mod length w)
w \<noteq> []
row (?v # ?M) ?i = ?v ! ?i # row ?M ?i
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss

goal (1 subgoal):
 1. row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal (1 subgoal):
 1. \<And>a M i. (\<And>i. i < length v * row_length M \<and> mat nr (length M) M \<longrightarrow> row (vec_mat_Tensor v M) i = local.times (v ! (i div row_length M)) (row M (i mod row_length M))) \<Longrightarrow> i < length v * row_length (a # M) \<and> mat nr (length (a # M)) (a # M) \<longrightarrow> row (vec_mat_Tensor v (a # M)) i = local.times (v ! (i div row_length (a # M))) (row (a # M) (i mod row_length (a # M)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<Longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal (1 subgoal):
 1. i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length v * row_length (w # N) \<and> mat nr (length (w # N)) (w # N) \<longrightarrow> row (vec_mat_Tensor v (w # N)) i = local.times (v ! (i div row_length (w # N))) (row (w # N) (i mod row_length (w # N)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_measurable_ereal_iff_Iio:
  "(f::'a \<Rightarrow> ereal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. f -` {..< a} \<inter> space M \<in> sets M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable M) = (\<forall>a. f -` {..<a} \<inter> space M \<in> sets M)
[PROOF STEP]
by (auto simp: borel_Iio measurable_iff_measure_of)


[STATEMENT]
lemma wfP_exists_minimal:
  assumes wf: "wfP p" and Q: "Q x"
  shows "\<exists>x. Q x \<and> (\<forall>y. p (f y) (f x) \<longrightarrow> \<not> Q y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. Q x \<and> (\<forall>y. p (f y) (f x) \<longrightarrow> \<not> Q y)
[PROOF STEP]
by (rule wf_exists_minimal[of "{(x, y). p x y}" Q x, OF wf[unfolded wfP_def] Q, simplified])


[STATEMENT]
lemma ereal_le_distrib:
  fixes a b c :: ereal
  shows "c * (a + b) \<le> c * a + c * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * (a + b) \<le> c * a + c * b
[PROOF STEP]
by (cases rule: ereal3_cases[of a b c])
     (auto simp add: field_simps not_le mult_le_0_iff mult_less_0_iff)


[STATEMENT]
lemma refine_using_invariants:
  "\<lbrakk> {R \<inter> I \<times> J} (trans Ta), (trans Tc) {> R};
     {I \<inter> Domain (R \<inter> UNIV \<times> J)} (trans Ta) {> I};
     {J \<inter> Range (R \<inter> I \<times> UNIV)} (trans Tc) {> J};
     init Tc \<subseteq> R``(init Ta);
     init Ta \<subseteq> I; init Tc \<subseteq> J \<rbrakk>
  \<Longrightarrow> PO_refines (R \<inter> I \<times> J) Ta Tc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>{R \<inter> I \<times> J} TS.trans Ta, TS.trans Tc {> R}; {I \<inter> Domain (R \<inter> UNIV \<times> J)} TS.trans Ta {> I}; {J \<inter> Range (R \<inter> I \<times> UNIV)} TS.trans Tc {> J}; init Tc \<subseteq> R `` init Ta; init Ta \<subseteq> I; init Tc \<subseteq> J\<rbrakk> \<Longrightarrow> PO_refines (R \<inter> I \<times> J) Ta Tc
[PROOF STEP]
by (unfold PO_refines_def)
   (intro refine_init_using_invariants refine_trans_using_invariants conjI)


[STATEMENT]
lemma measure_pmf_bind: "measure_pmf (bind_pmf M f) = (measure_pmf M \<bind> (\<lambda>x. measure_pmf (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf (M \<bind> f) = measure_pmf M \<bind> (\<lambda>x. measure_pmf (f x))
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma basis_wf_insert_exp_uminus':
  "f \<in> o(\<lambda>x. ln (b x)) \<Longrightarrow> (\<lambda>x. -f x) \<in> o(\<lambda>x. ln (b x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> o(\<lambda>x. ln (b x)) \<Longrightarrow> (\<lambda>x. - f x) \<in> o(\<lambda>x. ln (b x))
[PROOF STEP]
by simp


[STATEMENT]
lemma add_le_less_mono: "\<lbrakk> (a::nat) < c; b\<le>d \<rbrakk> \<Longrightarrow> a + b < c + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < c; b \<le> d\<rbrakk> \<Longrightarrow> a + b < c + d
[PROOF STEP]
by simp


[STATEMENT]
lemma join_cont': "chain Y \<Longrightarrow> (\<Squnion> i. Y i) \<squnion> y = (\<Squnion> i. Y i \<squnion> (y::'a::Finite_Join_cpo))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain Y \<Longrightarrow> (\<Squnion>i. Y i) \<squnion> y = (\<Squnion>i. Y i \<squnion> y)
[PROOF STEP]
by (metis all_compatible join_cont1)


[STATEMENT]
lemma tan_periodic_pi[simp]: "tan (x + pi) = tan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (x + pi) = tan x
[PROOF STEP]
by (simp add: tan_def)


[STATEMENT]
lemma setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p_member_iff:
  "(t,s) \<in> setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p x \<longleftrightarrow>
    (x = Insert t s \<or> x = Delete t s \<or> (\<exists>ac. x = InSet ac t s) \<or>
     (\<exists>X F F'. x = NegChecks X F F' \<and> (t,s) \<in> set F'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((t, s) \<in> setops\<^sub>s\<^sub>s\<^sub>t\<^sub>p x) = (x = insert\<langle>t,s\<rangle> \<or> x = delete\<langle>t,s\<rangle> \<or> (\<exists>ac. x = \<langle>ac: t \<in> s\<rangle>) \<or> (\<exists>X F F'. x = \<forall>X\<langle>\<or>\<noteq>: F \<or>\<notin>: F'\<rangle> \<and> (t, s) \<in> set F'))
[PROOF STEP]
by (cases x) auto


[STATEMENT]
theorem hurwitz_zeta_functional_equation:
  fixes h k :: nat and s :: complex
  assumes hk: "k > 0" "h \<in> {0<..k}" and s: "s \<notin> {0, 1}"
  defines "a \<equiv> real h / real k"
  shows "rGamma s * hurwitz_zeta a (1 - s) =
           2 * (2 * pi * k) powr -s *
             (\<Sum>n=1..k. cos (s*pi/2 - 2*pi*n*h/k) * hurwitz_zeta (n / k) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
from hk
[PROOF STATE]
proof (chain)
picking this:
0 < k
h \<in> {0<..k}
[PROOF STEP]
have a: "a \<in> {0<..1}"
[PROOF STATE]
proof (prove)
using this:
0 < k
h \<in> {0<..k}

goal (1 subgoal):
 1. a \<in> {0<..1}
[PROOF STEP]
by (auto simp: a_def)
[PROOF STATE]
proof (state)
this:
a \<in> {0<..1}

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "rGamma s * hurwitz_zeta a (1 - s) =
          (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s)
[PROOF STEP]
using s a
[PROOF STATE]
proof (prove)
using this:
s \<notin> {0, 1}
a \<in> {0<..1}

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s)
[PROOF STEP]
by (intro hurwitz_zeta_formula) auto
[PROOF STATE]
proof (state)
this:
rGamma s * hurwitz_zeta a (1 - s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rGamma s * hurwitz_zeta a (1 - s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "\<dots> = (2 * pi) powr - s * (\<i> powr - s * perzeta (of_int (int h) / k) s +
                                       \<i> powr s * perzeta (of_int (-int h) / k) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s)
[PROOF STEP]
by (simp add: a_def)
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta a s + \<i> powr s * perzeta (- a) s) = complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "\<dots> = (2 * pi) powr -s * k powr -s *
     ((\<Sum>n=1..k. \<i> powr -s * cis (2 * pi * n * h / k) * hurwitz_zeta (n / k) s) +
       (\<Sum>n=1..k. \<i> powr s  * cis (-2 * pi * n * h / k) * hurwitz_zeta (n / k) s))"
    (is "_ = _ * (?S1 + ?S2)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s) = complex_of_real (2 * pi) powr - s * of_nat k powr - s * ((\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s))
[PROOF STEP]
using hk a s
[PROOF STATE]
proof (prove)
using this:
0 < k
h \<in> {0<..k}
a \<in> {0<..1}
s \<notin> {0, 1}

goal (1 subgoal):
 1. complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s) = complex_of_real (2 * pi) powr - s * of_nat k powr - s * ((\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s))
[PROOF STEP]
by (subst (1 2) perzeta_conv_hurwitz_zeta_multiplication')
       (auto simp: field_simps sum_distrib_left sum_distrib_right exp_eq_polar)
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s) = complex_of_real (2 * pi) powr - s * of_nat k powr - s * ((\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s))

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * (\<i> powr - s * perzeta (real_of_int (int h) / real k) s + \<i> powr s * perzeta (real_of_int (- int h) / real k) s) = complex_of_real (2 * pi) powr - s * of_nat k powr - s * ((\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s))

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "(2 * pi) powr -s * k powr -s = (2 * k * pi) powr -s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (2 * pi) powr - s * of_nat k powr - s = complex_of_real (real (2 * k) * pi) powr - s
[PROOF STEP]
using hk pi_gt_zero
[PROOF STATE]
proof (prove)
using this:
0 < k
h \<in> {0<..k}
0 < pi

goal (1 subgoal):
 1. complex_of_real (2 * pi) powr - s * of_nat k powr - s = complex_of_real (real (2 * k) * pi) powr - s
[PROOF STEP]
by (simp add: powr_def Ln_times_Reals field_simps exp_add exp_diff exp_minus)
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * of_nat k powr - s = complex_of_real (real (2 * k) * pi) powr - s

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (2 * pi) powr - s * of_nat k powr - s = complex_of_real (real (2 * k) * pi) powr - s

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "?S1 + ?S2 = (\<Sum>n=1..k. (\<i> powr -s * cis (2*pi*n*h/k) + \<i> powr s * cis (-2*pi*n*h/k)) *
                                    hurwitz_zeta (n / k) s)"
    (is "_ = (\<Sum>n\<in>_. ?c n * _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) = (\<Sum>n = 1..k. (\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
by (simp add: algebra_simps sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) = (\<Sum>n = 1..k. (\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n = 1..k. \<i> powr - s * cis (2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) + (\<Sum>n = 1..k. \<i> powr s * cis (- 2 * pi * real n * real h / real k) * hurwitz_zeta (real n / real k) s) = (\<Sum>n = 1..k. (\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "?c = (\<lambda>n. 2 * cos (s*pi/2 - 2*pi*n*h/k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) = (\<lambda>x. 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real x * real h / real k)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
have "\<i> powr -s * cis (2*pi*n*h/k) = exp (-s*pi/2*\<i> + 2*pi*n*h/k*\<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i> + complex_of_real (2 * pi * real n * real h / real k) * \<i>)
[PROOF STEP]
unfolding exp_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i>) * exp (complex_of_real (2 * pi * real n * real h / real k) * \<i>)
[PROOF STEP]
by (simp add: powr_def cis_conv_exp mult_ac)
[PROOF STATE]
proof (state)
this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i> + complex_of_real (2 * pi * real n * real h / real k) * \<i>)

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i> + complex_of_real (2 * pi * real n * real h / real k) * \<i>)

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
have "\<i> powr s * cis (-2*pi*n*h/k) = exp (s*pi/2*\<i> + -2*pi*n*h/k*\<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (s * complex_of_real pi / 2 * \<i> + complex_of_real (- 2 * pi * real n * real h / real k) * \<i>)
[PROOF STEP]
unfolding exp_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (s * complex_of_real pi / 2 * \<i>) * exp (complex_of_real (- 2 * pi * real n * real h / real k) * \<i>)
[PROOF STEP]
by (simp add: powr_def cis_conv_exp mult_ac)
[PROOF STATE]
proof (state)
this:
\<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (s * complex_of_real pi / 2 * \<i> + complex_of_real (- 2 * pi * real n * real h / real k) * \<i>)

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i> + complex_of_real (2 * pi * real n * real h / real k) * \<i>)
\<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (s * complex_of_real pi / 2 * \<i> + complex_of_real (- 2 * pi * real n * real h / real k) * \<i>)
[PROOF STEP]
have "?c n = exp (\<i> * (s*pi/2 - 2*pi*n*h/k)) + exp (-(\<i> * (s*pi/2 - 2*pi*n*h/k)))"
[PROOF STATE]
proof (prove)
using this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) = exp (- s * complex_of_real pi / 2 * \<i> + complex_of_real (2 * pi * real n * real h / real k) * \<i>)
\<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (s * complex_of_real pi / 2 * \<i> + complex_of_real (- 2 * pi * real n * real h / real k) * \<i>)

goal (1 subgoal):
 1. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))) + exp (- (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))))
[PROOF STEP]
by (simp add: mult_ac ring_distribs)
[PROOF STATE]
proof (state)
this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))) + exp (- (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))))

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = exp (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))) + exp (- (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))))

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
have "\<dots> / 2 = cos (s*pi/2 - 2*pi*n*h/k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))) + exp (- (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))))) / 2 = cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
by (rule cos_exp_eq [symmetric])
[PROOF STATE]
proof (state)
this:
(exp (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))) + exp (- (\<i> * (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))))) / 2 = cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))

goal (1 subgoal):
 1. \<And>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) / 2 = cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
show "?c n = 2 * cos (s*pi/2 - 2*pi*n*h/k)"
[PROOF STATE]
proof (prove)
using this:
(\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) / 2 = cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))

goal (1 subgoal):
 1. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k) = 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) = (\<lambda>x. 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real x * real h / real k)))

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<i> powr - s * cis (2 * pi * real n * real h / real k) + \<i> powr s * cis (- 2 * pi * real n * real h / real k)) = (\<lambda>x. 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real x * real h / real k)))

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
have "(2 * k * pi) powr -s * (\<Sum>n=1..k. \<dots> n * hurwitz_zeta (n / k) s) =
               2 * (2 * pi * k) powr -s *
               (\<Sum>n=1..k. cos (s*pi/2 - 2*pi*n*h/k) * hurwitz_zeta (n / k) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (real (2 * k) * pi) powr - s * (\<Sum>n = 1..k. 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
by (simp add: sum_distrib_left sum_distrib_right mult_ac)
[PROOF STATE]
proof (state)
this:
complex_of_real (real (2 * k) * pi) powr - s * (\<Sum>n = 1..k. 2 * cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)

goal (1 subgoal):
 1. rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rGamma s * hurwitz_zeta a (1 - s) = 2 * complex_of_real (2 * pi * real k) powr - s * (\<Sum>n = 1..k. cos (s * complex_of_real pi / 2 - complex_of_real (2 * pi * real n * real h / real k)) * hurwitz_zeta (real n / real k) s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "x + (y + z) = y + (z + (x::int))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + (y + z) = y + (z + x)
[PROOF STEP]
by smt


[STATEMENT]
lemma prime_dvd_mult_eq_nat: "prime p \<Longrightarrow> p dvd m * n = (p dvd m \<or> p dvd n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> (p dvd m * n) = (p dvd m \<or> p dvd n)
[PROOF STEP]
by auto2


[STATEMENT]
lemma E_Start: "E Start = {Init j | j. j \<in> H \<and> p_i j \<noteq> 0 }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E Start = {Init j |j. j \<in> H \<and> p_i j \<noteq> 0}
[PROOF STEP]
using p_i_C
[PROOF STATE]
proof (prove)
using this:
?j \<in> C \<Longrightarrow> p_i ?j = 0

goal (1 subgoal):
 1. E Start = {Init j |j. j \<in> H \<and> p_i j \<noteq> 0}
[PROOF STEP]
by (auto simp: set_pmf_iff next_prob_def split: state.splits if_split_asm)


[STATEMENT]
lemma bij_perm_rem[simp]: "bij (perm_rem x f) \<longleftrightarrow> bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (perm_rem x f) = bij f
[PROOF STEP]
by (simp add: perm_rem_def bij_swap_compose)


[STATEMENT]
lemma size_pop [simp]: "\<lbrakk>0 < size current; invar current \<rbrakk>
   \<Longrightarrow> Suc (size (drop_first current)) = size current"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < size current; invar current\<rbrakk> \<Longrightarrow> Suc (size (drop_first current)) = size current
[PROOF STEP]
by(induction current rule: pop.induct) auto


[STATEMENT]
lemma right_total_rel_pred: "right_unique A \<Longrightarrow> right_total (rel_pred A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_unique A \<Longrightarrow> right_total (rel_pred A)
[PROOF STEP]
unfolding rel_pred_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. right_unique A \<Longrightarrow> right_total (A ===> (=))
[PROOF STEP]
by (erule right_total_fun) (rule right_total_eq)


[STATEMENT]
lemma llist_all2_ldropWhileI:
  assumes *: "llist_all2 P xs ys"
  and Q: "\<And>x y. P x y \<Longrightarrow> Q1 x \<longleftrightarrow> Q2 y"
  shows "llist_all2 P (ldropWhile Q1 xs) (ldropWhile Q2 ys)"
\<comment> \<open>cannot prove this with parallel induction over @{term xs} and @{term ys}
  because @{term "\<lambda>x. \<not> llist_all2 P (f x) (g x)"} is not admissible.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P (ldropWhile Q1 xs) (ldropWhile Q2 ys)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
llist_all2 P xs ys

goal (1 subgoal):
 1. llist_all2 P (ldropWhile Q1 xs) (ldropWhile Q2 ys)
[PROOF STEP]
by(induction arbitrary: xs ys rule: ldropWhile_fixp_parallel_induct)(auto split: llist.split dest: Q)


[STATEMENT]
lemma distinct_butlast_ne_last: "distinct xs \<Longrightarrow> x \<in> set (butlast xs) \<Longrightarrow> x \<noteq> last xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set (butlast xs)\<rbrakk> \<Longrightarrow> x \<noteq> last xs
[PROOF STEP]
by (metis append_butlast_last_id distinct_butlast empty_iff in_set_butlastD list.set(1)
    not_distinct_conv_prefix)


[STATEMENT]
lemma diagseq_holds:
  assumes subseq_stable: "\<And>r s n. strict_mono r \<Longrightarrow> P n s \<Longrightarrow> P n (s \<circ> r)"
  shows "P k (diagseq \<circ> ((+) (Suc k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P k (diagseq \<circ> (+) (Suc k))
[PROOF STEP]
unfolding diagseq_seqseq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P k (seqseq (Suc k) \<circ> (\<lambda>x. fold_reduce (Suc k) x (Suc k + x)))
[PROOF STEP]
by (intro subseq_stable subseq_diagonal_rest seqseq_holds)


[STATEMENT]
lemma app_tl_hd_list[rule_format]: "tl (map f [0..<length l] @ [a]) \<noteq> []
                             \<Longrightarrow> hd(map f [0..<length l] @ [a]) = (map f [0..<length l]) ! 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (map f [0..<length l] @ [a]) \<noteq> [] \<Longrightarrow> hd (map f [0..<length l] @ [a]) = map f [0..<length l] ! 0
[PROOF STEP]
by (drule tl_hd_not_empty, erule not_empty_hd_fst)


[STATEMENT]
lemma ratfps_nth_aux_correct: "ratfps_nth_aux p n = natfun_inverse (fps_of_poly p) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ratfps_nth_aux p n = natfun_inverse (fps_of_poly p) n
[PROOF STEP]
by (induction p n rule: ratfps_nth_aux.induct) simp_all


[STATEMENT]
lemma emptyLeftProperty:"\<forall>s. s setinterleaves (([], t), A)\<longrightarrow>s=t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. s setinterleaves (([], t), A) \<longrightarrow> s = t
[PROOF STEP]
apply(induct_tac t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>s. s setinterleaves (([], []), A) \<longrightarrow> s = []
 2. \<And>a list. \<forall>s. s setinterleaves (([], list), A) \<longrightarrow> s = list \<Longrightarrow> \<forall>s. s setinterleaves (([], a # list), A) \<longrightarrow> s = a # list
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a list. \<forall>s. s setinterleaves (([], list), A) \<longrightarrow> s = list \<Longrightarrow> \<forall>s. s setinterleaves (([], a # list), A) \<longrightarrow> s = a # list
[PROOF STEP]
by auto


[STATEMENT]
lemma Pbij_inverse_Rng: "Pbij_Dom (Pbij_inverse \<beta>) = Pbij_Rng \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pbij_Dom (Pbij_inverse \<beta>) = Pbij_Rng \<beta>
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pbij_Dom (Pbij_inverse \<beta>) = Pbij_Rng \<beta>
[PROOF STEP]
by (simp add: Pbij_inverse_def Pbij_Dom_def Pbij_Rng_def)


[STATEMENT]
lemma union_mulex_on_mono1:
  "A \<in> multisets F \<Longrightarrow> (mulex_on P F)\<^sup>=\<^sup>= A C \<Longrightarrow> mulex_on P F B D \<Longrightarrow>
    mulex_on P F (A + B) (C + D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> multisets F; (mulex_on P F)\<^sup>=\<^sup>= A C; mulex_on P F B D\<rbrakk> \<Longrightarrow> mulex_on P F (A + B) (C + D)
[PROOF STEP]
by (auto intro: union_mulex_on_mono mulex_on_union)


[STATEMENT]
lemma map_graph_edge_preserving[intro]:
  shows "edge_preserving f (edges G) (edges (map_graph f G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_preserving f (edges G) (edges (map_graph f G))
[PROOF STEP]
unfolding map_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_preserving f (edges G) (edges (LG (on_triple f `` edges G) (f `` vertices G)))
[PROOF STEP]
by auto


[STATEMENT]
lemma bin_rsplit_all: "0 < nw \<Longrightarrow> nw \<le> n \<Longrightarrow> bin_rsplit n (nw, w) = [(take_bit :: nat \<Rightarrow> int \<Rightarrow> int) n w]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < nw; nw \<le> n\<rbrakk> \<Longrightarrow> bin_rsplit n (nw, w) = [take_bit n w]
[PROOF STEP]
by (auto simp: bin_rsplit_def rsplit_aux_simp2ls split: prod.split dest!: split_bintrunc)


[STATEMENT]
lemma match_wf_tuple: "Some f = match ts xs \<Longrightarrow>
  wf_tuple n (\<Union>t\<in>set ts. Formula.fv_trm t) (Table.tabulate f 0 n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Some f = match ts xs \<Longrightarrow> wf_tuple n (\<Union> (fv_trm ` set ts)) (tabulate f 0 n)
[PROOF STEP]
by (induction ts xs arbitrary: f rule: match.induct)
    (fastforce simp: wf_tuple_def split: if_splits option.splits)+


[STATEMENT]
lemma (in PolynRg) csrp_fn_pol_coeff:"\<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y;
       pol_coeff (S /\<^sub>r P) (n,  c')\<rbrakk> \<Longrightarrow>
                          pol_coeff S (n, (cmp (csrp_fn S P) c'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y; pol_coeff (S /\<^sub>r P) (n, c')\<rbrakk> \<Longrightarrow> pol_coeff S (n, cmp (csrp_fn S P) c')
[PROOF STEP]
apply (cut_tac subring, frule subring_Ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y; pol_coeff (S /\<^sub>r P) (n, c'); Subring R S; Ring S\<rbrakk> \<Longrightarrow> pol_coeff S (n, cmp (csrp_fn S P) c')
[PROOF STEP]
apply (simp add:pol_coeff_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y; \<forall>j\<le>n. c' j \<in> carrier (S /\<^sub>r P); Subring R S; Ring S\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. cmp (csrp_fn S P) c' j \<in> carrier S
[PROOF STEP]
apply (rule allI, rule impI, simp add:cmp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y; \<forall>j\<le>n. c' j \<in> carrier (S /\<^sub>r P); Subring R S; Ring S; j \<le> n\<rbrakk> \<Longrightarrow> csrp_fn S P (c' j) \<in> carrier S
[PROOF STEP]
apply (rule Ring.csrp_fn_mem[of S P], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>ideal S P; PolynRg R' (S /\<^sub>r P) Y; \<forall>j\<le>n. c' j \<in> carrier (S /\<^sub>r P); Subring R S; Ring S; j \<le> n\<rbrakk> \<Longrightarrow> c' j \<in> carrier (S /\<^sub>r P)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem basic_consistency:
  "\<lbrakk>ve isofenv te; ve \<turnstile> e ---> v_const c; te \<turnstile> e ===> t\<rbrakk> \<Longrightarrow> c isof t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ve isofenv te; ve \<turnstile> e ---> v_const c; te \<turnstile> e ===> t\<rbrakk> \<Longrightarrow> c isof t
[PROOF STEP]
by (auto dest: consistency intro!: basic_consistency_aux)


[STATEMENT]
lemma bigo_const_mult1: "(\<lambda>x. c * f x) \<in> O(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * f x) \<in> O(f)
[PROOF STEP]
apply (simp add: bigo_def abs_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ca. \<forall>x. \<bar>c\<bar> * \<bar>f x\<bar> \<le> ca * \<bar>f x\<bar>
[PROOF STEP]
by (metis le_less)