[STATEMENT]
lemma lincomb_as_lincomb_list:
  fixes ws f
  assumes s: "set ws \<subseteq> carrier_vec n"
  shows "lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws!i = ws!j then 0 else f (ws ! i)) ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> carrier_vec n

goal (1 subgoal):
 1. lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
[PROOF STEP]
proof (induct ws rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
case (snoc a ws)
[PROOF STATE]
proof (state)
this:
set ws \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
set (ws @ [a]) \<subseteq> carrier_vec n

goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
let ?f = "\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0 else f (ws ! i)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
let ?g = "\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0 else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
let ?g2= "(\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0 else f (ws ! i)) \<cdot>\<^sub>v ws ! i)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
have [simp]: "\<And>v. v \<in> set ws \<Longrightarrow> v \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. v \<in> set ws \<Longrightarrow> v \<in> carrier_vec n
[PROOF STEP]
using snoc.prems(1)
[PROOF STATE]
proof (prove)
using this:
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<And>v. v \<in> set ws \<Longrightarrow> v \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?v2 \<in> set ws \<Longrightarrow> ?v2 \<in> carrier_vec n

goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?v2 \<in> set ws \<Longrightarrow> ?v2 \<in> carrier_vec n
[PROOF STEP]
have ws: "set ws \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
?v2 \<in> set ws \<Longrightarrow> ?v2 \<in> carrier_vec n

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

goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
have hyp: "lincomb f (set ws) = lincomb_list ?f ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
[PROOF STEP]
by (intro snoc.hyps ws)
[PROOF STATE]
proof (state)
this:
lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws

goal (2 subgoals):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
 2. \<And>x xs. \<lbrakk>set xs \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set xs) = lincomb_list (\<lambda>i. if \<exists>j<i. xs ! i = xs ! j then 0::'a else f (xs ! i)) xs; set (xs @ [x]) \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> lincomb f (set (xs @ [x])) = lincomb_list (\<lambda>i. if \<exists>j<i. (xs @ [x]) ! i = (xs @ [x]) ! j then 0::'a else f ((xs @ [x]) ! i)) (xs @ [x])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
proof (cases "a\<in>set ws")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a \<in> set ws

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have g_length: "?g (length ws) = 0\<^sub>v n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = 0\<^sub>v n
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
a \<in> set ws

goal (1 subgoal):
 1. (if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = 0\<^sub>v n
[PROOF STEP]
by (auto, metis in_set_conv_nth nth_append)
[PROOF STATE]
proof (state)
this:
(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = 0\<^sub>v n

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "(map ?g [0..<length (ws @ [a])]) = (map ?g [0..<length ws]) @ [?g (length ws)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (map ?g [0..<length ws]) @ [0\<^sub>v n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]
[PROOF STEP]
using g_length
[PROOF STATE]
proof (prove)
using this:
(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = 0\<^sub>v n

goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]
[PROOF STEP]
have map_rw: "(map ?g [0..<length (ws @ [a])]) = (map ?g [0..<length ws]) @ [0\<^sub>v n]"
[PROOF STATE]
proof (prove)
using this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]

goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n]

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "M.sumlist (map ?g2 [0..<length ws]) = M.sumlist (map ?g [0..<length ws])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws])
[PROOF STEP]
by (rule arg_cong[of _ _ "M.sumlist"], intro nth_equalityI, auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws])

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws])

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... =  M.sumlist (map ?g [0..<length ws]) + 0\<^sub>v n "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) + 0\<^sub>v n
[PROOF STEP]
by (metis M.r_zero calculation hyp lincomb_closed lincomb_list_def ws)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) + 0\<^sub>v n

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) + 0\<^sub>v n

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = M.sumlist (map ?g [0..<length ws] @ [0\<^sub>v n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) + 0\<^sub>v n = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])
[PROOF STEP]
by (rule M.sumlist_snoc[symmetric], auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) + 0\<^sub>v n = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])
[PROOF STEP]
have summlist_rw: "M.sumlist (map ?g2 [0..<length ws])
      = M.sumlist (map ?g [0..<length ws] @ [0\<^sub>v n])"
[PROOF STATE]
proof (prove)
using this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])

goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "lincomb f (set (ws @ [a])) = lincomb f (set ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb f (set ws)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
a \<in> set ws

goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb f (set ws)
[PROOF STEP]
unfolding lincomb_def
[PROOF STATE]
proof (prove)
using this:
a \<in> set ws

goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>set (ws @ [a]). f v \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v)
[PROOF STEP]
by (simp add: insert_absorb)
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb f (set ws)

goal (2 subgoals):
 1. a \<in> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
 2. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lincomb f (set (ws @ [a])) = lincomb f (set ws)

goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
unfolding hyp lincomb_list_def map_rw summlist_rw
[PROOF STATE]
proof (prove)
using this:
lincomb f (set (ws @ [a])) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])

goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [0\<^sub>v n])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<notin> set ws

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have g_length: "?g (length ws) = f a \<cdot>\<^sub>v a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = f a \<cdot>\<^sub>v a
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
a \<notin> set ws

goal (1 subgoal):
 1. (if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = f a \<cdot>\<^sub>v a
[PROOF STEP]
by (auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = f a \<cdot>\<^sub>v a

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "(map ?g [0..<length (ws @ [a])]) = (map ?g [0..<length ws]) @ [?g (length ws)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws]

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (map ?g [0..<length ws]) @ [(f a \<cdot>\<^sub>v a)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]
[PROOF STEP]
using g_length
[PROOF STATE]
proof (prove)
using this:
(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws = f a \<cdot>\<^sub>v a

goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [(if \<exists>j<length ws. (ws @ [a]) ! length ws = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! length ws)) \<cdot>\<^sub>v (ws @ [a]) ! length ws] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]
[PROOF STEP]
have map_rw: "(map ?g [0..<length (ws @ [a])]) = (map ?g [0..<length ws]) @ [(f a \<cdot>\<^sub>v a)]"
[PROOF STATE]
proof (prove)
using this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]

goal (1 subgoal):
 1. map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length (ws @ [a])] = map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws] @ [f a \<cdot>\<^sub>v a]

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have summlist_rw: "M.sumlist (map ?g2 [0..<length ws]) = M.sumlist (map ?g [0..<length ws])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws])
[PROOF STEP]
by (rule arg_cong[of _ _ "M.sumlist"], intro nth_equalityI, auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>i. (if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) \<cdot>\<^sub>v ws ! i) [0..<length ws]) = M.sumlist (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws])

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "lincomb f (set (ws @ [a])) = lincomb f (set (a # ws))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb f (set (a # ws))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb f (set (a # ws))

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb f (set (a # ws))

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (set (a # ws)) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v)
[PROOF STEP]
unfolding lincomb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
lincomb f (set (a # ws)) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb f (set (a # ws)) = (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (\<Oplus>\<^bsub>V\<^esub>v\<in> insert a (set ws). f v \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>set (a # ws). f v \<cdot>\<^sub>v v) = (\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (f a \<cdot>\<^sub>v a) + (\<Oplus>\<^bsub>V\<^esub>v\<in> (set ws). f v \<cdot>\<^sub>v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v)
[PROOF STEP]
proof (rule finsum_insert)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (set ws)
 2. a \<notin> set ws
 3. (\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n
 4. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "finite (set ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set ws)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (set ws)

goal (3 subgoals):
 1. a \<notin> set ws
 2. (\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n
 3. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "a \<notin> set ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin> set ws
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
a \<notin> set ws

goal (1 subgoal):
 1. a \<notin> set ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<notin> set ws

goal (2 subgoals):
 1. (\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n
 2. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "(\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n
[PROOF STEP]
using snoc.prems(1)
[PROOF STATE]
proof (prove)
using this:
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. (\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>v. f v \<cdot>\<^sub>v v) \<in> set ws \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "f a \<cdot>\<^sub>v a \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a \<in> carrier_vec n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>insert a (set ws). f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (f a \<cdot>\<^sub>v a) + lincomb f (set ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + lincomb f (set ws)
[PROOF STEP]
unfolding lincomb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + lincomb f (set ws)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + (\<Oplus>\<^bsub>V\<^esub>v\<in>set ws. f v \<cdot>\<^sub>v v) = f a \<cdot>\<^sub>v a + lincomb f (set ws)

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = (f a \<cdot>\<^sub>v a) + lincomb_list ?f ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + lincomb f (set ws) = f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
lincomb f (set ws) = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + lincomb f (set ws) = f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + lincomb f (set ws) = f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + lincomb f (set ws) = f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... =  lincomb_list ?f ws  + (f a \<cdot>\<^sub>v a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a
[PROOF STEP]
using M.add.m_comm lincomb_list_carrier snoc.prems
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier_vec n; ?y \<in> carrier_vec n\<rbrakk> \<Longrightarrow> ?x + ?y = ?y + ?x
set ?vs \<subseteq> carrier_vec n \<Longrightarrow> lincomb_list ?c ?vs \<in> carrier_vec n
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a + lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws = lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
have "... = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i
      = (ws @ [a]) ! j then 0 else f ((ws @ [a]) ! i)) (ws @ [a])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
proof (unfold lincomb_list_def map_rw summlist_rw, rule M.sumlist_snoc[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) \<subseteq> carrier_vec n
 2. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "set (map ?g [0..<length ws]) \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) \<subseteq> carrier_vec n
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. set (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) \<subseteq> carrier_vec n
[PROOF STEP]
by (auto simp add: nth_append)
[PROOF STATE]
proof (state)
this:
set (map (\<lambda>i. (if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) \<cdot>\<^sub>v (ws @ [a]) ! i) [0..<length ws]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
show "f a \<cdot>\<^sub>v a \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
using snoc.prems
[PROOF STATE]
proof (prove)
using this:
set (ws @ [a]) \<subseteq> carrier_vec n

goal (1 subgoal):
 1. f a \<cdot>\<^sub>v a \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a \<cdot>\<^sub>v a \<in> carrier_vec n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lincomb_list (\<lambda>i. if \<exists>j<i. ws ! i = ws ! j then 0::'a else f (ws ! i)) ws + f a \<cdot>\<^sub>v a = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])

goal (1 subgoal):
 1. a \<notin> set ws \<Longrightarrow> lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])

goal (1 subgoal):
 1. lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lincomb f (set (ws @ [a])) = lincomb_list (\<lambda>i. if \<exists>j<i. (ws @ [a]) ! i = (ws @ [a]) ! j then 0::'a else f ((ws @ [a]) ! i)) (ws @ [a])

goal (1 subgoal):
 1. set [] \<subseteq> carrier_vec n \<Longrightarrow> lincomb f (set []) = lincomb_list (\<lambda>i. if \<exists>j<i. [] ! i = [] ! j then 0::'a else f ([] ! i)) []
[PROOF STEP]
qed auto


[STATEMENT]
lemma tendsto_ln_over_powr:
  assumes "(a::real) > 0"
  shows   "((\<lambda>x. ln x / x powr a) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln x / x powr a) \<longlongrightarrow> 0) at_top
[PROOF STEP]
proof (rule lhospital_at_top_at_top)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. LIM x at_top. x powr a :> at_top
 2. \<forall>\<^sub>F x in at_top. ?g' x \<noteq> 0
 3. \<forall>\<^sub>F x in at_top. (ln has_real_derivative ?f' x) (at x)
 4. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative ?g' x) (at x)
 5. ((\<lambda>x. ?f' x / ?g' x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
show "LIM x at_top. x powr a :> at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. LIM x at_top. x powr a :> at_top
[PROOF STEP]
by (rule real_powr_at_top)
[PROOF STATE]
proof (state)
this:
LIM x at_top. x powr a :> at_top

goal (4 subgoals):
 1. \<forall>\<^sub>F x in at_top. ?g' x \<noteq> 0
 2. \<forall>\<^sub>F x in at_top. (ln has_real_derivative ?f' x) (at x)
 3. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative ?g' x) (at x)
 4. ((\<lambda>x. ?f' x / ?g' x) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show "eventually (\<lambda>x. a * x powr (a - 1) \<noteq> 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. a * x powr (a - 1) \<noteq> 0
[PROOF STEP]
using eventually_gt_at_top[of "0::real"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. a * x powr (a - 1) \<noteq> 0
[PROOF STEP]
by eventually_elim (insert assms, simp)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. a * x powr (a - 1) \<noteq> 0

goal (3 subgoals):
 1. \<forall>\<^sub>F x in at_top. (ln has_real_derivative ?f' x) (at x)
 2. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)
 3. ((\<lambda>x. ?f' x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show "eventually (\<lambda>x::real. (ln has_real_derivative (inverse x)) (at x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln has_real_derivative inverse x) (at x)
[PROOF STEP]
using eventually_gt_at_top[of "0::real"] DERIV_ln
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) at_top
0 < ?x \<Longrightarrow> (ln has_real_derivative inverse ?x) (at ?x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln has_real_derivative inverse x) (at x)
[PROOF STEP]
by (elim eventually_mono) simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (ln has_real_derivative inverse x) (at x)

goal (2 subgoals):
 1. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)
 2. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show "eventually (\<lambda>x. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)
[PROOF STEP]
using eventually_gt_at_top[of "0::real"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)
[PROOF STEP]
by eventually_elim (auto intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. ((\<lambda>x. x powr a) has_real_derivative a * x powr (a - 1)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
have "eventually (\<lambda>x. inverse a * x powr -a = inverse x / (a*x powr (a-1))) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))
[PROOF STEP]
using eventually_gt_at_top[of "0::real"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))
[PROOF STEP]
by (elim eventually_mono) (simp add: field_simps powr_diff powr_minus)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))

goal (1 subgoal):
 1. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))

goal (1 subgoal):
 1. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
have "((\<lambda>x. inverse a * x powr -a) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. ((\<lambda>x. inverse a * x powr - a) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (intro tendsto_mult_right_zero tendsto_neg_powr filterlim_ident) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse a * x powr - a) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))
((\<lambda>x. inverse a * x powr - a) \<longlongrightarrow> 0) at_top
[PROOF STEP]
show "((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. inverse a * x powr - a = inverse x / (a * x powr (a - 1))
((\<lambda>x. inverse a * x powr - a) \<longlongrightarrow> 0) at_top

goal (1 subgoal):
 1. ((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top
[PROOF STEP]
by (subst (asm) tendsto_cong) simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse x / (a * x powr (a - 1))) \<longlongrightarrow> 0) at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Gamma_bounds:
  assumes "x \<ge> 1"
  shows   "Gamma x \<ge> sqrt (2*pi/x) * (x / exp 1) powr x" (is ?th1)
          "Gamma x \<le> sqrt (2*pi/x) * (x / exp 1) powr x * exp (1 / (12 * x))" (is ?th2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 * pi / x) * (x / exp 1) powr x \<le> Gamma x &&& Gamma x \<le> sqrt (2 * pi / x) * (x / exp 1) powr x * exp (1 / (12 * x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sqrt (2 * pi / x) * (x / exp 1) powr x \<le> Gamma x
 2. Gamma x \<le> sqrt (2 * pi / x) * (x / exp 1) powr x * exp (1 / (12 * x))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> x
[PROOF STEP]
have "exp c * x powr (x - 1/2) / exp x = sqrt (2*pi/x) * (x / exp 1) powr x"
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x
[PROOF STEP]
by (subst powr_diff)
       (simp add: exp_c real_sqrt_divide powr_divide powr_half_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x

goal (2 subgoals):
 1. sqrt (2 * pi / x) * (x / exp 1) powr x \<le> Gamma x
 2. Gamma x \<le> sqrt (2 * pi / x) * (x / exp 1) powr x * exp (1 / (12 * x))
[PROOF STEP]
with Gamma_bounds_aux[OF assms]
[PROOF STATE]
proof (chain)
picking this:
exp c * x powr (x - 1 / 2) / exp x \<le> Gamma x
Gamma x \<le> exp c * x powr (x - 1 / 2) / exp x * exp (1 / (12 * x))
exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x
[PROOF STEP]
show ?th1 ?th2
[PROOF STATE]
proof (prove)
using this:
exp c * x powr (x - 1 / 2) / exp x \<le> Gamma x
Gamma x \<le> exp c * x powr (x - 1 / 2) / exp x * exp (1 / (12 * x))
exp c * x powr (x - 1 / 2) / exp x = sqrt (2 * pi / x) * (x / exp 1) powr x

goal (1 subgoal):
 1. sqrt (2 * pi / x) * (x / exp 1) powr x \<le> Gamma x &&& Gamma x \<le> sqrt (2 * pi / x) * (x / exp 1) powr x * exp (1 / (12 * x))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
sqrt (2 * pi / x) * (x / exp 1) powr x \<le> Gamma x
Gamma x \<le> sqrt (2 * pi / x) * (x / exp 1) powr x * exp (1 / (12 * x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_linear_factors: "degree (\<Prod> a \<leftarrow> as. [: f a, 1:]) = length as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as
[PROOF STEP]
proof (induct as)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (\<Prod>a\<leftarrow>[]. [:f a, 1::'a:]) = length []
 2. \<And>a as. degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as \<Longrightarrow> degree (\<Prod>a\<leftarrow>a # as. [:f a, 1::'a:]) = length (a # as)
[PROOF STEP]
case (Cons b as)
[PROOF STATE]
proof (state)
this:
degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as

goal (2 subgoals):
 1. degree (\<Prod>a\<leftarrow>[]. [:f a, 1::'a:]) = length []
 2. \<And>a as. degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as \<Longrightarrow> degree (\<Prod>a\<leftarrow>a # as. [:f a, 1::'a:]) = length (a # as)
[PROOF STEP]
note IH = this
[PROOF STATE]
proof (state)
this:
degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as

goal (2 subgoals):
 1. degree (\<Prod>a\<leftarrow>[]. [:f a, 1::'a:]) = length []
 2. \<And>a as. degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as \<Longrightarrow> degree (\<Prod>a\<leftarrow>a # as. [:f a, 1::'a:]) = length (a # as)
[PROOF STEP]
have id: "(\<Prod>a\<leftarrow>b # as. [:f a, 1:]) = [:f b,1 :] * (\<Prod>a\<leftarrow>as. [:f a, 1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>a\<leftarrow>b # as. [:f a, 1::'a:]) = [:f b, 1::'a:] * (\<Prod>a\<leftarrow>as. [:f a, 1::'a:])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>a\<leftarrow>b # as. [:f a, 1::'a:]) = [:f b, 1::'a:] * (\<Prod>a\<leftarrow>as. [:f a, 1::'a:])

goal (2 subgoals):
 1. degree (\<Prod>a\<leftarrow>[]. [:f a, 1::'a:]) = length []
 2. \<And>a as. degree (\<Prod>a\<leftarrow>as. [:f a, 1::'a:]) = length as \<Longrightarrow> degree (\<Prod>a\<leftarrow>a # as. [:f a, 1::'a:]) = length (a # as)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Prod>a\<leftarrow>b # as. [:f a, 1::'a:]) = length (b # as)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:f b, 1::'a:] * (\<Prod>a\<leftarrow>as. [:f a, 1::'a:])) = length (b # as)
[PROOF STEP]
by (subst degree_monic_mult, insert IH, auto)
[PROOF STATE]
proof (state)
this:
degree (\<Prod>a\<leftarrow>b # as. [:f a, 1::'a:]) = length (b # as)

goal (1 subgoal):
 1. degree (\<Prod>a\<leftarrow>[]. [:f a, 1::'a:]) = length []
[PROOF STEP]
qed simp


[STATEMENT]
lemma high_bound_aux: "ma < 2^(n+m) \<Longrightarrow> high ma n < 2^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ma < 2 ^ (n + m) \<Longrightarrow> high ma n < 2 ^ m
[PROOF STEP]
unfolding high_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ma < 2 ^ (n + m) \<Longrightarrow> ma div 2 ^ n < 2 ^ m
[PROOF STEP]
by (simp add: add.commute less_mult_imp_div_less power_add)


[STATEMENT]
lemma meta_all_eq_conv2: "(\<And>a. b = a \<Longrightarrow> PROP P a) \<equiv> PROP P b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. b = a \<Longrightarrow> PROP P a) \<equiv> PROP P b
[PROOF STEP]
apply(rule equal_intr_rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>a. b = a \<Longrightarrow> PROP P a) \<Longrightarrow> PROP P b
 2. \<And>a. \<lbrakk>PROP P b; b = a\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(erule meta_allE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (b = ?a3 \<Longrightarrow> PROP P ?a3) \<Longrightarrow> PROP P b
 2. \<And>a. \<lbrakk>PROP P b; b = a\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(erule meta_mp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b = b
 2. \<And>a. \<lbrakk>PROP P b; b = a\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(rule refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>PROP P b; b = a\<rbrakk> \<Longrightarrow> PROP P a
[PROOF STEP]
apply(hypsubst)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. PROP P b \<Longrightarrow> PROP P b
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tnth_TCons:
  "tnth (TCons x xs) n = (case n of 0 \<Rightarrow> x | Suc n' \<Rightarrow> tnth xs n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tnth (TCons x xs) n = (case n of 0 \<Rightarrow> x | Suc n' \<Rightarrow> tnth xs n')
[PROOF STEP]
by(transfer)(auto simp add: lnth_LCons split: nat.split)


[STATEMENT]
lemma natural_quotient_hom_image:
  "natural_quotient_hom H ` G = quotient_group H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. if a \<in> G then BinOpSetGroup.Abs_G_perm (G // LCoset_rel H) (+) (LCoset_rel H `` {a}) else 0) ` G = quotient_group H
[PROOF STEP]
unfolding quotient_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. if a \<in> G then BinOpSetGroup.Abs_G_perm (G // LCoset_rel H) (+) (LCoset_rel H `` {a}) else 0) ` G = BinOpSetGroup.Abs_G_perm (G // LCoset_rel H) (+) ` G // LCoset_rel H
[PROOF STEP]
by        (force elim: LCoset_rel_quotientE intro: LCoset_rel_quotientI)


[STATEMENT]
lemma suminf_pos_iff: "summable f \<Longrightarrow> (\<And>n. 0 \<le> f n) \<Longrightarrow> 0 < suminf f \<longleftrightarrow> (\<exists>i. 0 < f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> ((0::'a) < suminf f) = (\<exists>i. (0::'a) < f i)
[PROOF STEP]
using sum_le_suminf[of "{}"] suminf_eq_zero_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>summable f; finite {}; \<And>n. n \<in> - {} \<Longrightarrow> (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> sum f {} \<le> suminf f
\<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> (suminf f = (0::'a)) = (\<forall>n. f n = (0::'a))

goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) \<le> f n\<rbrakk> \<Longrightarrow> ((0::'a) < suminf f) = (\<exists>i. (0::'a) < f i)
[PROOF STEP]
by (simp add: less_le)


[STATEMENT]
lemma factor_mset_irred:
  assumes "x \<in> carrier G" "irreducible G x"
  shows "factor_mset G x = image_mset (assocs G) {#x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
have "wfactors G [x] x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wfactors G [x] x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G
irreducible G x

goal (1 subgoal):
 1. wfactors G [x] x
[PROOF STEP]
by (simp add:wfactors_def)
[PROOF STATE]
proof (state)
this:
wfactors G [x] x

goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
hence "factor_mset G x = fmset G [x]"
[PROOF STATE]
proof (prove)
using this:
wfactors G [x] x

goal (1 subgoal):
 1. factor_mset G x = fmset G [x]
[PROOF STEP]
using factor_mset_aux_1 assms
[PROOF STATE]
proof (prove)
using this:
wfactors G [x] x
\<lbrakk>?a \<in> carrier G; set ?as \<subseteq> carrier G; wfactors G ?as ?a\<rbrakk> \<Longrightarrow> factor_mset G ?a = fmset G ?as
x \<in> carrier G
irreducible G x

goal (1 subgoal):
 1. factor_mset G x = fmset G [x]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
factor_mset G x = fmset G [x]

goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
factor_mset G x = fmset G [x]

goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
have "... = image_mset (assocs G) {#x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmset G [x] = image_mset (assocs G) {#x#}
[PROOF STEP]
by (simp add:fmset_def)
[PROOF STATE]
proof (state)
this:
fmset G [x] = image_mset (assocs G) {#x#}

goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
factor_mset G x = image_mset (assocs G) {#x#}

goal (1 subgoal):
 1. factor_mset G x = image_mset (assocs G) {#x#}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
factor_mset G x = image_mset (assocs G) {#x#}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma module_hom_iff:
  "module_hom s1 s2  f \<longleftrightarrow>
    module s1 \<and> module s2 \<and>
    (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. module_hom s1 s2 f = (module s1 \<and> module s2 \<and> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x)))
[PROOF STEP]
by (simp add: module_hom_def module_hom_axioms_def)


[STATEMENT]
lemma (in comm_group) in_relationsI[intro]:
  assumes "finprod G (\<lambda>a. a [^] f a) A = \<one>" "f \<in> extensional A"
  shows "f \<in> relations A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> relations A
[PROOF STEP]
unfolding relations_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {f. (\<Otimes>a\<in>A. a [^] f a) = \<one>} \<inter> extensional A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<Otimes>a\<in>A. a [^] f a) = \<one>
f \<in> extensional A

goal (1 subgoal):
 1. f \<in> {f. (\<Otimes>a\<in>A. a [^] f a) = \<one>} \<inter> extensional A
[PROOF STEP]
by blast


[STATEMENT]
lemma reduce_column:
  assumes H: "H \<in> carrier_mat m n"
  and PK_H: "(P,K) = reduce_column div_op H"
  and m: "0 < m"
shows "P \<in> carrier_mat m m \<and> K \<in> carrier_mat m n \<and> P * H = K \<and> invertible_mat P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat m m \<and> K \<in> carrier_mat m n \<and> P * H = K \<and> invertible_mat P
[PROOF STEP]
by (rule reduce_column_aux[OF _ _ _ _ PK_H[unfolded reduce_column_def]], insert assms, auto)


[STATEMENT]
lemma norm_cauchy_schwarz: "inner x y \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x y \<le> norm x * norm y
[PROOF STEP]
using Cauchy_Schwarz_ineq2 [of x y]
[PROOF STATE]
proof (prove)
using this:
\<bar>inner x y\<bar> \<le> norm x * norm y

goal (1 subgoal):
 1. inner x y \<le> norm x * norm y
[PROOF STEP]
by auto


[STATEMENT]
lemma esssup_mono: "f \<in> borel_measurable M \<Longrightarrow> (\<And>x. f x \<le> g x) \<Longrightarrow> esssup M f \<le> esssup M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> borel_measurable M; \<And>x. f x \<le> g x\<rbrakk> \<Longrightarrow> esssup M f \<le> esssup M g
[PROOF STEP]
by (rule esssup_AE_mono) auto


[STATEMENT]
lemma extend_LeadsTo:
     "(extend h F \<in> (extend_set h A) LeadsTo (extend_set h B)) =
      (F \<in> A LeadsTo B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (extend h F \<in> extend_set h A \<longmapsto>w extend_set h B) = (F \<in> A \<longmapsto>w B)
[PROOF STEP]
by (simp add: LeadsTo_def reachable_extend_eq extend_leadsTo
              extend_set_Int_distrib [symmetric])


[STATEMENT]
lemma star_of_approx_zero_iff [simp]: "star_of k \<approx> 0 \<longleftrightarrow> k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_of k \<approx> 0) = (k = (0::'a))
[PROOF STEP]
by (simp_all add: star_of_approx_iff [symmetric])


[STATEMENT]
lemma vec_of_scal_dim[simp]:
  "dim_vec (vec_of_scal x) = 1"
  "vec_of_scal x \<in> carrier_vec 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_scal x) = 1 &&& vec_of_scal x \<in> carrier_vec 1
[PROOF STEP]
unfolding vec_of_scal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec 1 (\<lambda>i. x)) = 1 &&& vec 1 (\<lambda>i. x) \<in> carrier_vec 1
[PROOF STEP]
by auto


[STATEMENT]
lemma zero_less_of_rat_iff [simp]: "0 < (of_rat r :: 'a::linordered_field) \<longleftrightarrow> 0 < r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < of_rat r) = (0 < r)
[PROOF STEP]
using of_rat_less [of 0 r, where 'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_rat 0 < of_rat r) = (0 < r)

goal (1 subgoal):
 1. ((0::'a) < of_rat r) = (0 < r)
[PROOF STEP]
by simp


[STATEMENT]
lemma differentiable_Pair [simp, derivative_intros]:
  "f differentiable at x within s \<Longrightarrow> g differentiable at x within s \<Longrightarrow>
    (\<lambda>x. (f x, g x)) differentiable at x within s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; g differentiable at x within s\<rbrakk> \<Longrightarrow> (\<lambda>x. (f x, g x)) differentiable at x within s
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>D. (f has_derivative D) (at x within s); \<exists>D. (g has_derivative D) (at x within s)\<rbrakk> \<Longrightarrow> \<exists>D. ((\<lambda>x. (f x, g x)) has_derivative D) (at x within s)
[PROOF STEP]
by (blast intro: has_derivative_Pair)


[STATEMENT]
lemma kripke_tc_rels_worlds[dest]:
  assumes R: "(w, w') \<in> (\<Union>a \<in> as. relations M a)\<^sup>+"
  assumes M: "kripke M"
  shows "w \<in> worlds M \<and> w' \<in> worlds M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> worlds M \<and> w' \<in> worlds M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(w, w') \<in> (\<Union> (relations M ` as))\<^sup>+
kripke M

goal (1 subgoal):
 1. w \<in> worlds M \<and> w' \<in> worlds M
[PROOF STEP]
by (induct rule: trancl_induct) auto


[STATEMENT]
lemma starfun_n_add: "( *fn* f) z + ( *fn* g) z = ( *fn* (\<lambda>i x. f i x + g i x)) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*fn* f) z + (*fn* g) z = (*fn* (\<lambda>i x. f i x + g i x)) z
[PROOF STEP]
by (cases z) (simp add: starfun_n star_n_add)


[STATEMENT]
lemma continuous_at_right_real_increasing:
  fixes f :: "real \<Rightarrow> real"
  assumes nondecF: "\<And>x y. x \<le> y \<Longrightarrow> f x \<le> f y"
  shows "continuous (at_right a) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at_right a) f = (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)
[PROOF STEP]
apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>d>0. \<forall>x>a. x - a \<le> d \<longrightarrow> \<bar>f x - f a\<bar> < e) = (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)
[PROOF STEP]
apply (intro all_cong ex_cong, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e d. \<lbrakk>0 < e; 0 < d; \<forall>x>a. x - a \<le> d \<longrightarrow> \<bar>f x - f a\<bar> < e\<rbrakk> \<Longrightarrow> f (a + d) - f a < e
 2. \<And>e d x. \<lbrakk>0 < e; 0 < d; f (a + d) - f a < e; a < x; x - a \<le> d\<rbrakk> \<Longrightarrow> \<bar>f x - f a\<bar> < e
[PROOF STEP]
apply (erule_tac x="a + d" in allE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e d x. \<lbrakk>0 < e; 0 < d; f (a + d) - f a < e; a < x; x - a \<le> d\<rbrakk> \<Longrightarrow> \<bar>f x - f a\<bar> < e
[PROOF STEP]
apply (simp add: nondecF field_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e d x. \<lbrakk>0 < e; f (d + a) < e + f a; a < x; x \<le> d + a\<rbrakk> \<Longrightarrow> f x < e + f a
[PROOF STEP]
apply (drule nondecF, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Corps) Vr_potent_eq:"\<lbrakk>valuation K v; 0 \<le> n; 0 \<le> m;
              (vp K v) \<^bsup>(Vr K v) n\<^esup> = (vp K v) \<^bsup>(Vr K v) m\<^esup>\<rbrakk> \<Longrightarrow>  n = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; 0 \<le> n; 0 \<le> m; vp K v\<^bsup> Vr K v n\<^esup> = vp K v\<^bsup> Vr K v m\<^esup>\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply (frule n_val_valuation[of v],
       case_tac "m = 0",
       simp add:Vr_potent_eqTr1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; 0 \<le> n; 0 \<le> m; vp K v\<^bsup> Vr K v n\<^esup> = vp K v\<^bsup> Vr K v m\<^esup>; valuation K (n_val K v); m \<noteq> 0\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply (case_tac "n = 0",
       frule sym, thin_tac "vp K v\<^bsup> (Vr K v) n\<^esup> = vp K v\<^bsup> (Vr K v) m\<^esup>",
       frule Vr_potent_eqTr1[of v m n], assumption+,
       rule sym, assumption,
       frule vp_potent_zero[of  "v" "n"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; 0 \<le> n; 0 \<le> m; vp K v\<^bsup> Vr K v n\<^esup> = vp K v\<^bsup> Vr K v m\<^esup>; valuation K (n_val K v); m \<noteq> 0; n \<noteq> 0; (n = \<infinity>) = (vp K v\<^bsup> Vr K v n\<^esup> = {\<zero>\<^bsub>Vr K v\<^esub>})\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply (case_tac "n = \<infinity>", simp,
       thin_tac "vp K v\<^bsup> (Vr K v) \<infinity>\<^esup> = {\<zero>\<^bsub>Vr K v\<^esub>}",
       frule vp_potent_zero[THEN sym, of v m], assumption+, simp,
       simp,
       frule vp_potent_zero[THEN sym, of v "m"], assumption+, simp,
       thin_tac "vp K v\<^bsup> (Vr K v) m\<^esup> \<noteq> {\<zero>\<^bsub>Vr K v\<^esub>}")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; 0 \<le> n; 0 \<le> m; vp K v\<^bsup> Vr K v n\<^esup> = vp K v\<^bsup> Vr K v m\<^esup>; valuation K (n_val K v); m \<noteq> 0; n \<noteq> 0; m \<noteq> \<infinity>; n \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> n = m
[PROOF STEP]
apply (frule aposs_na_poss[of "n"], subst less_le, simp,
       frule aposs_na_poss[of "m"], subst less_le, simp,
       simp add:r_apow_def,
       frule Vr_potent_eqTr2[of  "v" "na n" "na m"], assumption+,
       thin_tac "vp K v \<^bsup>\<diamondsuit>(Vr K v) (na n)\<^esup> = vp K v \<^bsup>\<diamondsuit>(Vr K v) (na m)\<^esup>",
       simp add:aeq_nat_eq[THEN sym])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma smooth_on_open_Un:
  "k-smooth_on S f \<Longrightarrow> k-smooth_on T f \<Longrightarrow> open S \<Longrightarrow> open T \<Longrightarrow> k-smooth_on (S \<union> T) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k-smooth_on S f; k-smooth_on T f; open S; open T\<rbrakk> \<Longrightarrow> k-smooth_on (S \<union> T) f
[PROOF STEP]
by (auto simp: smooth_on_def higher_differentiable_on_open_Un)


[STATEMENT]
lemma compute_mpoly_to_nested_poly[code]:
  "coeffs (mpoly_to_nested_poly mp v) =
    (if mp = 0 then []
    else map (isolate_variable_sparse mp v) [0..<Suc(MPoly_Type.degree mp v)])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.coeffs (mpoly_to_nested_poly mp v) = (if mp = 0 then [] else map (isolate_variable_sparse mp v) [0..<Suc (MPoly_Type.degree mp v)])
[PROOF STEP]
unfolding coeffs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if mpoly_to_nested_poly mp v = 0 then [] else map (poly.coeff (mpoly_to_nested_poly mp v)) [0..<Suc (Polynomial.degree (mpoly_to_nested_poly mp v))]) = (if mp = 0 then [] else map (isolate_variable_sparse mp v) [0..<Suc (MPoly_Type.degree mp v)])
[PROOF STEP]
unfolding mpoly_to_nested_poly_eq_zero_iff degree_eq_univariate_degree
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if mp = 0 then [] else map (poly.coeff (mpoly_to_nested_poly mp v)) [0..<Suc (Polynomial.degree (mpoly_to_nested_poly mp v))]) = (if mp = 0 then [] else map (isolate_variable_sparse mp v) [0..<Suc (if mp = 0 then 0 else Polynomial.degree (mpoly_to_nested_poly mp v))])
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>mp \<noteq> 0; x < Polynomial.degree (mpoly_to_nested_poly mp v)\<rbrakk> \<Longrightarrow> poly.coeff (mpoly_to_nested_poly mp v) x = isolate_variable_sparse mp v x
 2. mp \<noteq> 0 \<Longrightarrow> lead_coeff (mpoly_to_nested_poly mp v) = isolate_variable_sparse mp v (Polynomial.degree (mpoly_to_nested_poly mp v))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mp \<noteq> 0; x_ < Polynomial.degree (mpoly_to_nested_poly mp v)\<rbrakk> \<Longrightarrow> poly.coeff (mpoly_to_nested_poly mp v) x_ = isolate_variable_sparse mp v x_
[PROOF STEP]
by transfer' (rule refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mp \<noteq> 0 \<Longrightarrow> lead_coeff (mpoly_to_nested_poly mp v) = isolate_variable_sparse mp v (Polynomial.degree (mpoly_to_nested_poly mp v))
[PROOF STEP]
by transfer' (rule refl)


[STATEMENT]
lemma vec_uniqueness:
 assumes "vec m v"
     and "vec n v"
 shows "m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n
[PROOF STEP]
using vec_def assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
vec ?n ?x = (length ?x = ?n)
vec m v
vec n v

goal (1 subgoal):
 1. m = n
[PROOF STEP]
by metis


[STATEMENT]
lemma Above_Linear_singleton:
  assumes "x \<in> Field r"
  assumes "Linear_order r"
  shows "x \<in> Above r {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Above r {x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> Field r
Linear_order r

goal (1 subgoal):
 1. x \<in> Above r {x}
[PROOF STEP]
unfolding Above_def order_on_defs
[PROOF STATE]
proof (prove)
using this:
x \<in> Field r
((Refl r \<and> trans r) \<and> antisym r) \<and> Total r

goal (1 subgoal):
 1. x \<in> {b \<in> Field r. \<forall>a\<in>{x}. (a, b) \<in> r}
[PROOF STEP]
by (force dest: refl_onD)


[STATEMENT]
lemma summable_comparison_test_ev:
  "eventually (\<lambda>n. norm (f n) \<le> g n) sequentially \<Longrightarrow> summable g \<Longrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>\<^sub>F n in sequentially. norm (f n) \<le> g n; summable g\<rbrakk> \<Longrightarrow> summable f
[PROOF STEP]
by (rule summable_comparison_test) (auto simp: eventually_at_top_linorder)


[STATEMENT]
lemma is_orthogonal_sym: "is_orthogonal \<psi> \<phi> = is_orthogonal \<phi> \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_orthogonal \<psi> \<phi> = is_orthogonal \<phi> \<psi>
[PROOF STEP]
by (metis cinner_commute' complex_cnj_zero)


[STATEMENT]
lemma cos_one_2pi: "cos x = 1 \<longleftrightarrow> (\<exists>n::nat. x = n * 2 * pi) \<or> (\<exists>n::nat. x = - (n * 2 * pi))"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x = 1) = ((\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cos x = 1 \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
cos x = 1

goal (2 subgoals):
 1. cos x = 1 \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos x = 1
[PROOF STEP]
have "sin x = 0"
[PROOF STATE]
proof (prove)
using this:
cos x = 1

goal (1 subgoal):
 1. sin x = 0
[PROOF STEP]
by (simp add: cos_one_sin_zero)
[PROOF STATE]
proof (state)
this:
sin x = 0

goal (2 subgoals):
 1. cos x = 1 \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin x = 0
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
sin x = 0

goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
proof (simp only: sin_zero_iff, elim exE disjE conjE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = real n * (pi / 2)\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = real n * (pi / 2)\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
assume n: "even n" "x = real n * (pi/2)"
[PROOF STATE]
proof (state)
this:
even n
x = real n * (pi / 2)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = real n * (pi / 2)\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even n
x = real n * (pi / 2)
[PROOF STEP]
obtain m where m: "n = 2 * m"
[PROOF STATE]
proof (prove)
using this:
even n
x = real n * (pi / 2)

goal (1 subgoal):
 1. (\<And>m. n = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using dvdE
[PROOF STATE]
proof (prove)
using this:
even n
x = real n * (pi / 2)
\<lbrakk>?b dvd ?a; \<And>k. ?a = ?b * k \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>m. n = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n = 2 * m

goal (2 subgoals):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = real n * (pi / 2)\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 2 * m
[PROOF STEP]
have me: "even m"
[PROOF STATE]
proof (prove)
using this:
n = 2 * m

goal (1 subgoal):
 1. even m
[PROOF STEP]
using \<open>?lhs\<close> n
[PROOF STATE]
proof (prove)
using this:
n = 2 * m
cos x = 1
even n
x = real n * (pi / 2)

goal (1 subgoal):
 1. even m
[PROOF STEP]
by (auto simp: field_simps) (metis one_neq_neg_one  power_minus_odd power_one)
[PROOF STATE]
proof (state)
this:
even m

goal (2 subgoals):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = real n * (pi / 2)\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
 2. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
using m me n
[PROOF STATE]
proof (prove)
using this:
n = 2 * m
even m
even n
x = real n * (pi / 2)

goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
by (auto simp: field_simps elim!: evenE)
[PROOF STATE]
proof (state)
this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
assume n: "even n" "x = - (real n * (pi/2))"
[PROOF STATE]
proof (state)
this:
even n
x = - (real n * (pi / 2))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even n
x = - (real n * (pi / 2))
[PROOF STEP]
obtain m where m: "n = 2 * m"
[PROOF STATE]
proof (prove)
using this:
even n
x = - (real n * (pi / 2))

goal (1 subgoal):
 1. (\<And>m. n = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using dvdE
[PROOF STATE]
proof (prove)
using this:
even n
x = - (real n * (pi / 2))
\<lbrakk>?b dvd ?a; \<And>k. ?a = ?b * k \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>m. n = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n = 2 * m

goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 2 * m
[PROOF STEP]
have me: "even m"
[PROOF STATE]
proof (prove)
using this:
n = 2 * m

goal (1 subgoal):
 1. even m
[PROOF STEP]
using \<open>?lhs\<close> n
[PROOF STATE]
proof (prove)
using this:
n = 2 * m
cos x = 1
even n
x = - (real n * (pi / 2))

goal (1 subgoal):
 1. even m
[PROOF STEP]
by (auto simp: field_simps) (metis one_neq_neg_one  power_minus_odd power_one)
[PROOF STATE]
proof (state)
this:
even m

goal (1 subgoal):
 1. \<And>n. \<lbrakk>sin x = 0; even n; x = - (real n * (pi / 2))\<rbrakk> \<Longrightarrow> (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
using m me n
[PROOF STATE]
proof (prove)
using this:
n = 2 * m
even m
even n
x = - (real n * (pi / 2))

goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
by (auto simp: field_simps elim!: evenE)
[PROOF STATE]
proof (state)
this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))

goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))

goal (1 subgoal):
 1. (\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi)) \<Longrightarrow> cos x = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))
[PROOF STEP]
show "cos x = 1"
[PROOF STATE]
proof (prove)
using this:
(\<exists>xa. x = real xa * 2 * pi) \<or> (\<exists>xa. x = - (real xa * 2 * pi))

goal (1 subgoal):
 1. cos x = 1
[PROOF STEP]
by (metis cos_2npi cos_minus mult.assoc mult.left_commute)
[PROOF STATE]
proof (state)
this:
cos x = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_sum_set_Suc [simp]: "k#ks \<in> length_sum_set (Suc r) n \<longleftrightarrow> (\<exists>m. ks \<in> length_sum_set r m \<and> n = m+k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k # ks \<in> length_sum_set (Suc r) n) = (\<exists>m. ks \<in> length_sum_set r m \<and> n = m + k)
[PROOF STEP]
by (auto simp: length_sum_set_def)


[STATEMENT]
lemma find_first_append:
  "find_first x (ys @ zs) =
    (case find_first x ys of None \<Rightarrow> map_option (\<lambda>i. i + length ys) (find_first x zs) | Some a \<Rightarrow> Some a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. find_first x (ys @ zs) = (case find_first x ys of None \<Rightarrow> map_option (\<lambda>i. i + length ys) (find_first x zs) | Some a \<Rightarrow> Some a)
[PROOF STEP]
by (induct ys) (auto simp: option.map_comp comp_def map_option.identity split: option.splits)


[STATEMENT]
lemma continuous_on_arccos [continuous_intros]:
  "continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. -1 \<le> f x \<and> f x \<le> 1) \<Longrightarrow> continuous_on s (\<lambda>x. arccos (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on s f; \<forall>x\<in>s. - 1 \<le> f x \<and> f x \<le> 1\<rbrakk> \<Longrightarrow> continuous_on s (\<lambda>x. arccos (f x))
[PROOF STEP]
using continuous_on_compose[of s f, OF _ continuous_on_subset[OF  continuous_on_arccos']]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on s f; f ` s \<subseteq> {- 1..1}\<rbrakk> \<Longrightarrow> continuous_on s (arccos \<circ> f)

goal (1 subgoal):
 1. \<lbrakk>continuous_on s f; \<forall>x\<in>s. - 1 \<le> f x \<and> f x \<le> 1\<rbrakk> \<Longrightarrow> continuous_on s (\<lambda>x. arccos (f x))
[PROOF STEP]
by (auto simp: comp_def subset_eq)


[STATEMENT]
lemma app_vrrestrictionE[elim]:
  assumes "x \<in>\<^sub>\<circ> r \<restriction>\<^sup>r\<^sub>\<circ> A"
  obtains a b where "x = \<langle>a, b\<rangle>" and "b \<in>\<^sub>\<circ> A" and "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; b \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> r \<restriction>\<^sup>r\<^sub>\<circ> A

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; b \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vrrestriction_def
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> (\<lambda>\<langle>r, A\<rangle>\<in>\<^sub>\<circ>set {\<langle>r, A\<rangle>}. set {\<langle>a, b\<rangle> |a b. b \<in>\<^sub>\<circ> A \<and> \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})\<lparr>\<langle>r, A\<rangle>\<rparr>

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = \<langle>a, b\<rangle>; b \<in>\<^sub>\<circ> A; \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma algebraic_prod_list [intro]:
  "(\<And>x. x \<in> set xs \<Longrightarrow> algebraic x) \<Longrightarrow> algebraic (prod_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> algebraic x) \<Longrightarrow> algebraic (prod_list xs)
[PROOF STEP]
by (induction xs) (auto intro!: algebraic_times)