[STATEMENT]
lemma paths_insert_maximal :
  assumes "mp_trie_invar t"
  shows "set (paths (insert xs t)) = (if (\<exists> xs' . xs@xs' \<in> set (paths t))
                                         then set (paths t)
                                         else Set.insert xs (set (paths t) - {xs' . \<exists> xs'' . xs'@xs'' = xs}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar t

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
[PROOF STEP]
proof (induction xs arbitrary: t)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert [] t)) = (if \<exists>xs'. [] @ xs' \<in> set (paths t) then set (paths t) else Set.insert [] (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = []}))
 2. \<And>a xs t. \<lbrakk>\<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs})); mp_trie_invar t\<rbrakk> \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (a # xs) t)) = (if \<exists>xs'. (a # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (a # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = a # xs}))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
mp_trie_invar t

goal (2 subgoals):
 1. \<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert [] t)) = (if \<exists>xs'. [] @ xs' \<in> set (paths t) then set (paths t) else Set.insert [] (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = []}))
 2. \<And>a xs t. \<lbrakk>\<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs})); mp_trie_invar t\<rbrakk> \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (a # xs) t)) = (if \<exists>xs'. (a # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (a # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = a # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mp_trie_invar t
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar t

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert [] t)) = (if \<exists>xs'. [] @ xs' \<in> set (paths t) then set (paths t) else Set.insert [] (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = []}))
[PROOF STEP]
using paths_nonempty
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar t
[] \<notin> set (paths ?t) \<Longrightarrow> set (paths ?t) \<noteq> {}

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert [] t)) = (if \<exists>xs'. [] @ xs' \<in> set (paths t) then set (paths t) else Set.insert [] (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = []}))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert [] t)) = (if \<exists>xs'. [] @ xs' \<in> set (paths t) then set (paths t) else Set.insert [] (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = []}))

goal (1 subgoal):
 1. \<And>a xs t. \<lbrakk>\<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs})); mp_trie_invar t\<rbrakk> \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (a # xs) t)) = (if \<exists>xs'. (a # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (a # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = a # xs}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs t. \<lbrakk>\<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs})); mp_trie_invar t\<rbrakk> \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (a # xs) t)) = (if \<exists>xs'. (a # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (a # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = a # xs}))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
mp_trie_invar ?t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs ?t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths ?t) then set (paths ?t) else Set.insert xs (set (paths ?t) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
mp_trie_invar t

goal (1 subgoal):
 1. \<And>a xs t. \<lbrakk>\<And>t. mp_trie_invar t \<Longrightarrow> set (paths (Maximal_Path_Trie.insert xs t)) = (if \<exists>xs'. xs @ xs' \<in> set (paths t) then set (paths t) else Set.insert xs (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = xs})); mp_trie_invar t\<rbrakk> \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (a # xs) t)) = (if \<exists>xs'. (a # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (a # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = a # xs}))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
proof (cases "t = empty")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. t = Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
t = Maximal_Path_Trie.empty

goal (2 subgoals):
 1. t = Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) Maximal_Path_Trie.empty)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths Maximal_Path_Trie.empty) then set (paths Maximal_Path_Trie.empty) else Set.insert (x # xs) (set (paths Maximal_Path_Trie.empty) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
unfolding paths_insert_empty
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [x # xs] = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths Maximal_Path_Trie.empty) then set (paths Maximal_Path_Trie.empty) else Set.insert (x # xs) (set (paths Maximal_Path_Trie.empty) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
unfolding empty_def paths.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set [x # xs] = (if \<exists>xs'. (x # xs) @ xs' \<in> set [[]] then set [[]] else Set.insert (x # xs) (set [[]] - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
t \<noteq> Maximal_Path_Trie.empty

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<noteq> Maximal_Path_Trie.empty
[PROOF STEP]
obtain xt xts where "t = MP_Trie (xt#xts)"
[PROOF STATE]
proof (prove)
using this:
t \<noteq> Maximal_Path_Trie.empty

goal (1 subgoal):
 1. (\<And>xt xts. t = MP_Trie (xt # xts) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis empty_def height.cases)
[PROOF STATE]
proof (state)
this:
t = MP_Trie (xt # xts)

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t = MP_Trie (xt # xts)
[PROOF STEP]
have "t = MP_Trie ((fst xt, snd xt)#xts)"
[PROOF STATE]
proof (prove)
using this:
t = MP_Trie (xt # xts)

goal (1 subgoal):
 1. t = MP_Trie ((fst xt, snd xt) # xts)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t = MP_Trie ((fst xt, snd xt) # xts)

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "distinct (map fst (xt#xts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst (xt # xts))
[PROOF STEP]
using Cons.prems \<open>t = MP_Trie (xt#xts)\<close>
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar t
t = MP_Trie (xt # xts)

goal (1 subgoal):
 1. distinct (map fst (xt # xts))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (map fst (xt # xts))

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "(paths t) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paths t = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))
[PROOF STEP]
unfolding \<open>t = MP_Trie ((fst xt, snd xt)#xts)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paths (MP_Trie ((fst xt, snd xt) # xts)) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
paths t = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
paths t = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))
[PROOF STEP]
have "set (paths t) = {x#xs | x xs t . (x,t) \<in> set (xt#xts) \<and> xs \<in> set (paths t)}"
[PROOF STATE]
proof (prove)
using this:
paths t = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))

goal (1 subgoal):
 1. set (paths t) = {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths t) = {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (paths t) = {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}
[PROOF STEP]
have "Set.insert (x#xs) (set (paths t)) = Set.insert (x#xs) {x#xs | x xs t . (x,t) \<in> set (xt#xts) \<and> xs \<in> set (paths t)}"
[PROOF STATE]
proof (prove)
using this:
set (paths t) = {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}

goal (1 subgoal):
 1. Set.insert (x # xs) (set (paths t)) = Set.insert (x # xs) {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Set.insert (x # xs) (set (paths t)) = Set.insert (x # xs) {uu_. \<exists>x xs t. uu_ = x # xs \<and> (x, t) \<in> set (xt # xts) \<and> xs \<in> set (paths t)}

goal (1 subgoal):
 1. t \<noteq> Maximal_Path_Trie.empty \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
proof (cases "x \<in> set (map fst (xt#xts))")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> set (map fst (xt # xts))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> set (map fst (xt # xts))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (map fst (xt # xts))
[PROOF STEP]
obtain i where "i < length (xt#xts)" and "fst ((xt#xts) ! i) = x"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (map fst (xt # xts))

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length (xt # xts); fst ((xt # xts) ! i) = x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis in_set_conv_nth list_map_source_elem)
[PROOF STATE]
proof (state)
this:
i < length (xt # xts)
fst ((xt # xts) ! i) = x

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < length (xt # xts)
fst ((xt # xts) ! i) = x
[PROOF STEP]
have "((xt#xts) ! i) = (x,snd ((xt#xts) ! i))"
[PROOF STATE]
proof (prove)
using this:
i < length (xt # xts)
fst ((xt # xts) ! i) = x

goal (1 subgoal):
 1. (xt # xts) ! i = (x, snd ((xt # xts) ! i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(xt # xts) ! i = (x, snd ((xt # xts) ! i))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "mp_trie_invar (snd ((xt # xts) ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mp_trie_invar (snd ((xt # xts) ! i))
[PROOF STEP]
using Cons.prems \<open>i < length (xt#xts)\<close>
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar t
i < length (xt # xts)

goal (1 subgoal):
 1. mp_trie_invar (snd ((xt # xts) ! i))
[PROOF STEP]
unfolding \<open>t = MP_Trie (xt#xts)\<close>
[PROOF STATE]
proof (prove)
using this:
mp_trie_invar (MP_Trie (xt # xts))
i < length (xt # xts)

goal (1 subgoal):
 1. mp_trie_invar (snd ((xt # xts) ! i))
[PROOF STEP]
by (metis \<open>(xt # xts) ! i = (x, snd ((xt # xts) ! i))\<close> in_set_zipE mp_trie_invar.simps nth_mem zip_map_fst_snd)
[PROOF STATE]
proof (state)
this:
mp_trie_invar (snd ((xt # xts) ! i))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "insert (x#xs) t = MP_Trie (take i (xt # xts) @ [(x, insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Maximal_Path_Trie.insert (x # xs) t = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))
[PROOF STEP]
unfolding \<open>t = MP_Trie (xt#xts)\<close> insert.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MP_Trie (update_assoc_list_with_default x (Maximal_Path_Trie.insert xs) Maximal_Path_Trie.empty (xt # xts)) = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))
[PROOF STEP]
unfolding update_assoc_list_with_default_key_found[OF \<open>distinct (map fst (xt#xts))\<close> \<open>i < length (xt#xts)\<close> \<open>fst ((xt#xts) ! i) = x\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)) = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Maximal_Path_Trie.insert (x # xs) t = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Maximal_Path_Trie.insert (x # xs) t = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))
[PROOF STEP]
have "set (paths (insert (x#xs) t))
                 = set (paths (MP_Trie (take i (xt # xts) @ [(x, insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
Maximal_Path_Trie.insert (x # xs) t = MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "... = set (paths (MP_Trie ((x, insert xs (snd ((xt # xts) ! i))) # (take i (xt # xts) @ drop (Suc i) (xt # xts)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)))) = set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
using paths_order[of "(take i (xt # xts) @ [(x, insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts))"
                             "((x, insert xs (snd ((xt # xts) ! i))) # (take i (xt # xts) @ drop (Suc i) (xt # xts)))"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)) = set ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts)); length (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)) = length ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))\<rbrakk> \<Longrightarrow> set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)))) = set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)))) = set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)))) = set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (paths (MP_Trie (take i (xt # xts) @ [(x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))] @ drop (Suc i) (xt # xts)))) = set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "... = set ((map ((#) x) (paths (insert xs (snd ((xt # xts) ! i))))) @ (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
unfolding paths.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (MP_Trie ((x, Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
have "set (paths (insert (x#xs) t)) =
                      set (map ((#) x) (paths (insert xs (snd ((xt # xts) ! i)))))
                      \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "\<dots> = (image ((#) x) (set (paths (insert xs (snd ((xt # xts) ! i))))))
                      \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = (#) x ` set (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (map ((#) x) (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i))))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = (#) x ` set (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` set (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
have pi1: "set (paths (insert (x#xs) t)) =
                      image ((#) x) (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i)))
                                                                                else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
                       \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` set (paths (Maximal_Path_Trie.insert xs (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
unfolding Cons.IH[OF \<open>mp_trie_invar (snd ((xt # xts) ! i))\<close>]
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have po1: "set (xt#xts) = set ((x,snd ((xt#xts) ! i)) # ((take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (xt # xts) = set ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
using list_index_split_set[OF \<open>i < length (xt#xts)\<close>]
[PROOF STATE]
proof (prove)
using this:
set (xt # xts) = set ((xt # xts) ! i # take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. set (xt # xts) = set ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
unfolding \<open>((xt#xts) ! i) = (x,snd ((xt#xts) ! i))\<close>[symmetric]
[PROOF STATE]
proof (prove)
using this:
set (xt # xts) = set ((xt # xts) ! i # take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. set (xt # xts) = set ((xt # xts) ! i # take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
set (xt # xts) = set ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have po2: "length (xt#xts) = length ((x,snd ((xt#xts) ! i)) # ((take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (xt # xts) = length ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
using \<open>i < length (xt#xts)\<close>
[PROOF STATE]
proof (prove)
using this:
i < length (xt # xts)

goal (1 subgoal):
 1. length (xt # xts) = length ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (xt # xts) = length ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "set (paths t) = set (paths (MP_Trie ((x,snd ((xt#xts) ! i)) # ((take i (xt # xts) @ drop (Suc i) (xt # xts))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths t) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
unfolding \<open>t = MP_Trie (xt#xts)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (MP_Trie (xt # xts))) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
using paths_order[OF po1 po2]
[PROOF STATE]
proof (prove)
using this:
set (paths (MP_Trie (xt # xts))) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (MP_Trie (xt # xts))) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
set (paths t) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (paths t) = set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "\<dots> = set ((map ((#) x) (paths (snd ((xt # xts) ! i)))) @ (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (snd ((xt # xts) ! i))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
unfolding paths.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (snd ((xt # xts) ! i))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths (MP_Trie ((x, snd ((xt # xts) ! i)) # take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (map ((#) x) (paths (snd ((xt # xts) ! i))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
have "set (paths t) =
                      set (map ((#) x) (paths (snd ((xt # xts) ! i))))
                      \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i))) @ concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
have pi2: "set (paths t) = (image ((#) x) (set (paths (snd ((xt # xts) ! i)))))
                      \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
set (paths t) = set (map ((#) x) (paths (snd ((xt # xts) ! i)))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths t) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths t) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. x \<in> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
proof (cases "\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))
[PROOF STEP]
have pi1': "set (paths (insert (x#xs) t)) = image ((#) x) (set (paths (snd ((xt # xts) ! i))))
                                                         \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
using pi1
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "set (paths (insert (x # xs) t)) = set (paths t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths t)
[PROOF STEP]
unfolding pi1' pi2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths t)

goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths t)

goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
unfolding pi2
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (2 subgoals):
 1. \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
 2. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths t)
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = set (paths t)
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))
[PROOF STEP]
have pi1': "set (paths (insert (x#xs) t)) = image ((#) x) (Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
                                                         \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
\<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
using pi1
[PROOF STATE]
proof (prove)
using this:
\<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` (if \<exists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) then set (paths (snd ((xt # xts) ! i))) else Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have x1: "((#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))
              = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
have "\<And> a . a \<in> ((#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})) \<Longrightarrow>
                       a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<Longrightarrow> a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<Longrightarrow> ?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<Longrightarrow> ?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
have "\<And> a . a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow>
                                a \<in> ((#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
assume "a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (state)
this:
a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. \<And>a. a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
consider (a) "a = (x#xs)" |
                          (b) "a \<in> ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (prove)
using this:
a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. \<lbrakk>a = x # xs \<Longrightarrow> thesis; a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>a = x # xs \<Longrightarrow> ?thesis; a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>a. a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>a = x # xs \<Longrightarrow> ?thesis; a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show "a \<in> ((#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a = x # xs \<Longrightarrow> ?thesis; a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = x # xs \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
 2. a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
case a
[PROOF STATE]
proof (state)
this:
a = x # xs

goal (2 subgoals):
 1. a = x # xs \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
 2. a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = x # xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = x # xs

goal (1 subgoal):
 1. a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal (1 subgoal):
 1. a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
case b
[PROOF STATE]
proof (state)
this:
a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} \<Longrightarrow> a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> ?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<Longrightarrow> ?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> ?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) \<Longrightarrow> ?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
?a \<in> Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<Longrightarrow> ?a \<in> (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs})

goal (1 subgoal):
 1. (#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(#) x ` Set.insert xs (set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have x2: "set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
                      = (set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
        and  x3: "\<not>(\<exists>xs'. (x # xs) @ xs' \<in> set (paths t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs} &&& \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
 2. \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
have "\<And> j . j < length (xt#xts) \<Longrightarrow> j \<noteq> i \<Longrightarrow> fst ((xt#xts) ! j) \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < length (xt # xts); j \<noteq> i\<rbrakk> \<Longrightarrow> fst ((xt # xts) ! j) \<noteq> x
[PROOF STEP]
using \<open>i < length (xt#xts)\<close> \<open>fst ((xt#xts) ! i) = x\<close> \<open>distinct (map fst (xt#xts))\<close>
[PROOF STATE]
proof (prove)
using this:
i < length (xt # xts)
fst ((xt # xts) ! i) = x
distinct (map fst (xt # xts))

goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < length (xt # xts); j \<noteq> i\<rbrakk> \<Longrightarrow> fst ((xt # xts) ! j) \<noteq> x
[PROOF STEP]
by (metis (no_types, lifting) length_map nth_eq_iff_index_eq nth_map)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?j < length (xt # xts); ?j \<noteq> i\<rbrakk> \<Longrightarrow> fst ((xt # xts) ! ?j) \<noteq> x

goal (2 subgoals):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
 2. \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
have "\<And> xt' . xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xt'. xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xt'. xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
fix xt'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xt'. xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
assume "xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts))"
[PROOF STATE]
proof (state)
this:
xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. \<And>xt'. xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts))
[PROOF STEP]
consider (a) "xt' \<in> set (take i (xt # xts))" |
                          (b) "xt' \<in> set (drop (Suc i) (xt # xts))"
[PROOF STATE]
proof (prove)
using this:
xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. \<lbrakk>xt' \<in> set (take i (xt # xts)) \<Longrightarrow> thesis; xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>xt' \<in> set (take i (xt # xts)) \<Longrightarrow> ?thesis; xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>xt'. xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>xt' \<in> set (take i (xt # xts)) \<Longrightarrow> ?thesis; xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show "fst xt' \<noteq> x"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>xt' \<in> set (take i (xt # xts)) \<Longrightarrow> ?thesis; xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. fst xt' \<noteq> x
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
case a
[PROOF STATE]
proof (state)
this:
xt' \<in> set (take i (xt # xts))

goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xt' \<in> set (take i (xt # xts))
[PROOF STEP]
obtain j where "j < length (take i (xt#xts))" "(take i (xt#xts)) ! j = xt'"
[PROOF STATE]
proof (prove)
using this:
xt' \<in> set (take i (xt # xts))

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>j < length (take i (xt # xts)); take i (xt # xts) ! j = xt'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
j < length (take i (xt # xts))
take i (xt # xts) ! j = xt'

goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
have "j < length (xt#xts)" and "j < i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < length (xt # xts) &&& j < i
[PROOF STEP]
using \<open>j < length (take i (xt#xts))\<close>
[PROOF STATE]
proof (prove)
using this:
j < length (take i (xt # xts))

goal (1 subgoal):
 1. j < length (xt # xts) &&& j < i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j < length (xt # xts)
j < i

goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j < length (xt # xts)
j < i

goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
have "(xt#xts) ! j = xt'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xt # xts) ! j = xt'
[PROOF STEP]
using \<open>(take i (xt#xts)) ! j = xt'\<close> \<open>j < i\<close>
[PROOF STATE]
proof (prove)
using this:
take i (xt # xts) ! j = xt'
j < i

goal (1 subgoal):
 1. (xt # xts) ! j = xt'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(xt # xts) ! j = xt'

goal (2 subgoals):
 1. xt' \<in> set (take i (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
 2. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
j < length (xt # xts)
j < i
(xt # xts) ! j = xt'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j < length (xt # xts)
j < i
(xt # xts) ! j = xt'

goal (1 subgoal):
 1. fst xt' \<noteq> x
[PROOF STEP]
using \<open>\<And> j . j < length (xt#xts) \<Longrightarrow> j \<noteq> i \<Longrightarrow> fst ((xt#xts) ! j) \<noteq> x\<close>
[PROOF STATE]
proof (prove)
using this:
j < length (xt # xts)
j < i
(xt # xts) ! j = xt'
\<lbrakk>?j < length (xt # xts); ?j \<noteq> i\<rbrakk> \<Longrightarrow> fst ((xt # xts) ! ?j) \<noteq> x

goal (1 subgoal):
 1. fst xt' \<noteq> x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
fst xt' \<noteq> x

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
case b
[PROOF STATE]
proof (state)
this:
xt' \<in> set (drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
xt' \<in> set (drop (Suc i) (xt # xts))
[PROOF STEP]
obtain j where "j < length (drop (Suc i) (xt#xts))" "(drop (Suc i) (xt#xts)) ! j = xt'"
[PROOF STATE]
proof (prove)
using this:
xt' \<in> set (drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. (\<And>j. \<lbrakk>j < length (drop (Suc i) (xt # xts)); drop (Suc i) (xt # xts) ! j = xt'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson in_set_conv_nth)
[PROOF STATE]
proof (state)
this:
j < length (drop (Suc i) (xt # xts))
drop (Suc i) (xt # xts) ! j = xt'

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
have "(Suc i) + j < length (xt#xts)" and "(Suc i) + j > i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc i + j < length (xt # xts) &&& i < Suc i + j
[PROOF STEP]
using \<open>j < length (drop (Suc i) (xt#xts))\<close>
[PROOF STATE]
proof (prove)
using this:
j < length (drop (Suc i) (xt # xts))

goal (1 subgoal):
 1. Suc i + j < length (xt # xts) &&& i < Suc i + j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Suc i + j < length (xt # xts)
i < Suc i + j

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Suc i + j < length (xt # xts)
i < Suc i + j

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
have "(xt#xts) ! ((Suc i) + j) = xt'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xt # xts) ! (Suc i + j) = xt'
[PROOF STEP]
using \<open>(drop (Suc i) (xt#xts)) ! j = xt'\<close>
[PROOF STATE]
proof (prove)
using this:
drop (Suc i) (xt # xts) ! j = xt'

goal (1 subgoal):
 1. (xt # xts) ! (Suc i + j) = xt'
[PROOF STEP]
using \<open>i < length (xt # xts)\<close>
[PROOF STATE]
proof (prove)
using this:
drop (Suc i) (xt # xts) ! j = xt'
i < length (xt # xts)

goal (1 subgoal):
 1. (xt # xts) ! (Suc i + j) = xt'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(xt # xts) ! (Suc i + j) = xt'

goal (1 subgoal):
 1. xt' \<in> set (drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Suc i + j < length (xt # xts)
i < Suc i + j
(xt # xts) ! (Suc i + j) = xt'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc i + j < length (xt # xts)
i < Suc i + j
(xt # xts) ! (Suc i + j) = xt'

goal (1 subgoal):
 1. fst xt' \<noteq> x
[PROOF STEP]
using \<open>\<And> j . j < length (xt#xts) \<Longrightarrow> j \<noteq> i \<Longrightarrow> fst ((xt#xts) ! j) \<noteq> x\<close>[of "(Suc i) + j"]
[PROOF STATE]
proof (prove)
using this:
Suc i + j < length (xt # xts)
i < Suc i + j
(xt # xts) ! (Suc i + j) = xt'
\<lbrakk>Suc i + j < length (xt # xts); Suc i + j \<noteq> i\<rbrakk> \<Longrightarrow> fst ((xt # xts) ! (Suc i + j)) \<noteq> x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
fst xt' \<noteq> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst ?xt' \<noteq> x

goal (2 subgoals):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
 2. \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst ?xt' \<noteq> x
[PROOF STEP]
show "set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
                      = (set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (prove)
using this:
?xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst ?xt' \<noteq> x

goal (1 subgoal):
 1. set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
show "\<not>(\<exists>xs'. (x # xs) @ xs' \<in> set (paths t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) \<Longrightarrow> False
[PROOF STEP]
assume "\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)"
[PROOF STATE]
proof (state)
this:
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)
[PROOF STEP]
obtain xs' where "(x # (xs @ xs')) \<in> ((#) x ` set (paths (snd ((xt # xts) ! i)))) \<union>
                                                          set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (1 subgoal):
 1. (\<And>xs'. x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding pi2
[PROOF STATE]
proof (prove)
using this:
\<exists>xs'. (x # xs) @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. (\<And>xs'. x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
consider (a) "(x # (xs @ xs')) \<in> ((#) x ` set (paths (snd ((xt # xts) ! i))))" |
                          (b) "(x # (xs @ xs')) \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
using this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. \<lbrakk>x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> thesis; x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> ?thesis; x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> ?thesis; x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> ?thesis; x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. False
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> False
 2. x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> False
[PROOF STEP]
case a
[PROOF STATE]
proof (state)
this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i)))

goal (2 subgoals):
 1. x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> False
 2. x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i)))

goal (1 subgoal):
 1. False
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
x # xs @ xs' \<in> (#) x ` set (paths (snd ((xt # xts) ! i)))
\<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i)))

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

goal (1 subgoal):
 1. x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> False
[PROOF STEP]
case b
[PROOF STATE]
proof (state)
this:
x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>\<And> xt' . xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst xt' \<noteq> x\<close>
[PROOF STATE]
proof (prove)
using this:
x # xs @ xs' \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
?xt' \<in> set (take i (xt # xts) @ drop (Suc i) (xt # xts)) \<Longrightarrow> fst ?xt' \<noteq> x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
\<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have *: "Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
                  = Set.insert (x # xs) (((#) x ` set (paths (snd ((xt # xts) ! i)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
using x2
[PROOF STATE]
proof (prove)
using this:
set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "set (paths (insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
unfolding pi1' pi2 x1 *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts)))) = Set.insert (x # xs) ((#) x ` set (paths (snd ((xt # xts) ! i))) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}) \<union> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (take i (xt # xts) @ drop (Suc i) (xt # xts))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. \<nexists>xs'. xs @ xs' \<in> set (paths (snd ((xt # xts) ! i))) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
using x3
[PROOF STATE]
proof (prove)
using this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs})
\<nexists>xs'. (x # xs) @ xs' \<in> set (paths t)

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> set (map fst (xt # xts))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "insert (x#xs) t = MP_Trie (xt # (xts @ [(x, insert xs empty)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Maximal_Path_Trie.insert (x # xs) t = MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])
[PROOF STEP]
unfolding \<open>t = MP_Trie (xt#xts)\<close> insert.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MP_Trie (update_assoc_list_with_default x (Maximal_Path_Trie.insert xs) Maximal_Path_Trie.empty (xt # xts)) = MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])
[PROOF STEP]
unfolding update_assoc_list_with_default_key_not_found[OF \<open>distinct (map fst (xt#xts))\<close> False]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MP_Trie ((xt # xts) @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)]) = MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Maximal_Path_Trie.insert (x # xs) t = MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "(paths (MP_Trie (xt # (xts @ [(x, insert xs empty)])))) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, insert xs empty)]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)]))
[PROOF STEP]
unfolding paths.simps empty_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs (MP_Trie []))])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs (MP_Trie []))]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)]))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)]))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "... = (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))) @ (map ((#) x) (paths (insert xs empty))) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts)) @ map ((#) x) (paths (Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts)) @ map ((#) x) (paths (Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts)) @ map ((#) x) (paths (Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty))
[PROOF STEP]
have "paths (insert (x#xs) t) = (paths t) @ [x#xs]"
[PROOF STATE]
proof (prove)
using this:
paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts)) @ map ((#) x) (paths (Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty))

goal (1 subgoal):
 1. paths (Maximal_Path_Trie.insert (x # xs) t) = paths t @ [x # xs]
[PROOF STEP]
unfolding \<open>insert (x#xs) t = MP_Trie (xt # (xts @ [(x, insert xs empty)]))\<close>
                  \<open>(paths t) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))\<close>[symmetric]
                  paths_insert_empty
[PROOF STATE]
proof (prove)
using this:
paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = paths t @ map ((#) x) [xs]

goal (1 subgoal):
 1. paths (MP_Trie (xt # xts @ [(x, Maximal_Path_Trie.insert xs Maximal_Path_Trie.empty)])) = paths t @ [x # xs]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
paths (Maximal_Path_Trie.insert (x # xs) t) = paths t @ [x # xs]

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
paths (Maximal_Path_Trie.insert (x # xs) t) = paths t @ [x # xs]
[PROOF STEP]
have "set (paths (insert (x#xs) t)) = Set.insert (x#xs) (set (paths t))"
[PROOF STATE]
proof (prove)
using this:
paths (Maximal_Path_Trie.insert (x # xs) t) = paths t @ [x # xs]

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = Set.insert (x # xs) (set (paths t))

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
have "\<And> p . p \<in> set (paths t) \<Longrightarrow> p \<noteq> [] \<and> hd p \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. p \<in> set (paths t) \<Longrightarrow> p \<noteq> [] \<and> hd p \<noteq> x
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
x \<notin> set (map fst (xt # xts))

goal (1 subgoal):
 1. \<And>p. p \<in> set (paths t) \<Longrightarrow> p \<noteq> [] \<and> hd p \<noteq> x
[PROOF STEP]
unfolding \<open>(paths t) = concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))\<close>
[PROOF STATE]
proof (prove)
using this:
x \<notin> set (map fst (xt # xts))

goal (1 subgoal):
 1. \<And>p. p \<in> set (concat (map (\<lambda>(x, t). map ((#) x) (paths t)) (xt # xts))) \<Longrightarrow> p \<noteq> [] \<and> hd p \<noteq> x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?p \<in> set (paths t) \<Longrightarrow> ?p \<noteq> [] \<and> hd ?p \<noteq> x

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?p \<in> set (paths t) \<Longrightarrow> ?p \<noteq> [] \<and> hd ?p \<noteq> x
[PROOF STEP]
have "\<And> xs' . xs' \<in> set (paths t) \<Longrightarrow> \<not>(\<exists> xs'' . xs'@xs'' = x#xs)"
[PROOF STATE]
proof (prove)
using this:
?p \<in> set (paths t) \<Longrightarrow> ?p \<noteq> [] \<and> hd ?p \<noteq> x

goal (1 subgoal):
 1. \<And>xs'. xs' \<in> set (paths t) \<Longrightarrow> \<nexists>xs''. xs' @ xs'' = x # xs
[PROOF STEP]
by (metis hd_append2 list.sel(1))
[PROOF STATE]
proof (state)
this:
?xs' \<in> set (paths t) \<Longrightarrow> \<nexists>xs''. ?xs' @ xs'' = x # xs

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?xs' \<in> set (paths t) \<Longrightarrow> \<nexists>xs''. ?xs' @ xs'' = x # xs
[PROOF STEP]
have "set (paths t) = (set (paths t) - {xs' . \<exists> xs'' . xs'@xs'' = x#xs})"
[PROOF STATE]
proof (prove)
using this:
?xs' \<in> set (paths t) \<Longrightarrow> \<nexists>xs''. ?xs' @ xs'' = x # xs

goal (1 subgoal):
 1. set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. x \<notin> set (map fst (xt # xts)) \<Longrightarrow> set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
unfolding \<open>set (paths (insert (x#xs) t)) = Set.insert (x#xs) (set (paths t))\<close>
[PROOF STATE]
proof (prove)
using this:
set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}

goal (1 subgoal):
 1. Set.insert (x # xs) (set (paths t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
using \<open>\<And>p. p \<in> set (paths t) \<Longrightarrow> p \<noteq> [] \<and> hd p \<noteq> x\<close>
[PROOF STATE]
proof (prove)
using this:
set (paths t) = set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}
?p \<in> set (paths t) \<Longrightarrow> ?p \<noteq> [] \<and> hd ?p \<noteq> x

goal (1 subgoal):
 1. Set.insert (x # xs) (set (paths t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (paths (Maximal_Path_Trie.insert (x # xs) t)) = (if \<exists>xs'. (x # xs) @ xs' \<in> set (paths t) then set (paths t) else Set.insert (x # xs) (set (paths t) - {xs'. \<exists>xs''. xs' @ xs'' = x # xs}))

goal:
No subgoals!
[PROOF STEP]
qed