[STATEMENT]
lemma nfa_steps_quantify_nfa:
  assumes "wf_nfa N (Suc n)"
  and "list_all (is_alph n) w"
  and "nfa_is_node N q"
  and "v \<le> n"
  shows "set_of_bv (nfa_steps (quantify_nfa v N) q w) = (\<Union>xs \<in> {x. length x = length w}. set_of_bv (nfa_steps N q (insertll v xs w)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q w) = (\<Union>xs\<in>{x. length x = length w}. set_of_bv (nfa_steps N q (insertll v xs w)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_nfa N (Suc n)
list_all (is_alph n) w
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q w) = (\<Union>xs\<in>{x. length x = length w}. set_of_bv (nfa_steps N q (insertll v xs w)))
[PROOF STEP]
proof (induct w rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) []; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q []) = (\<Union>xs\<in>{x. length x = length []}. set_of_bv (nfa_steps N q (insertll v xs [])))
 2. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
wf_nfa N (Suc n)
list_all (is_alph n) []
nfa_is_node N q
v \<le> n

goal (2 subgoals):
 1. \<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) []; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q []) = (\<Union>xs\<in>{x. length x = length []}. set_of_bv (nfa_steps N q (insertll v xs [])))
 2. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_nfa N (Suc n)
list_all (is_alph n) []
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q []) = (\<Union>xs\<in>{x. length x = length []}. set_of_bv (nfa_steps N q (insertll v xs [])))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q []) = (\<Union>xs\<in>{x. length x = length []}. set_of_bv (nfa_steps N q (insertll v xs [])))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
hence "wf_nfa (quantify_nfa v N) n"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. wf_nfa (quantify_nfa v N) n
[PROOF STEP]
by (simp add: quantify_nfa_well_formed_aut)
[PROOF STATE]
proof (state)
this:
wf_nfa (quantify_nfa v N) n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_nfa (quantify_nfa v N) n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
[PROOF STEP]
have "nfa_is_node (quantify_nfa v N) q"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. nfa_is_node (quantify_nfa v N) q
[PROOF STEP]
by (simp add: nfa_is_node_def quantify_nfa_def split_beta)
[PROOF STATE]
proof (state)
this:
nfa_is_node (quantify_nfa v N) q

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
nfa_is_node (quantify_nfa v N) q

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
note snoc
[PROOF STATE]
proof (state)
this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
wf_nfa (quantify_nfa v N) n
nfa_is_node (quantify_nfa v N) q
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
[PROOF STEP]
have "nfa_is_node (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs)"
[PROOF STATE]
proof (prove)
using this:
wf_nfa (quantify_nfa v N) n
nfa_is_node (quantify_nfa v N) q
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. nfa_is_node (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs)
[PROOF STEP]
by (simp add: nfa_steps_is_node[of _ n])
[PROOF STATE]
proof (state)
this:
nfa_is_node (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
hence N: "nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)" (is "nfa_is_node N ?q")
[PROOF STATE]
proof (prove)
using this:
nfa_is_node (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs)

goal (1 subgoal):
 1. nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)
[PROOF STEP]
by (simp add: nfa_is_node_def quantify_nfa_def split_beta)
[PROOF STATE]
proof (state)
this:
nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
[PROOF STEP]
have "\<And>b. length (insertl v b x) = Suc n"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. \<And>b. length (insertl v b x) = Suc n
[PROOF STEP]
by (simp add: insertl_len is_alph_def)
[PROOF STATE]
proof (state)
this:
length (insertl v ?b x) = Suc n

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
with snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
length (insertl v ?b x) = Suc n
[PROOF STEP]
have B: "\<And>b. wf_nfa N (length (insertl v b x))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
length (insertl v ?b x) = Suc n

goal (1 subgoal):
 1. \<And>b. wf_nfa N (length (insertl v b x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
wf_nfa N (length (insertl v ?b x))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
[PROOF STEP]
have IV: "set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x \<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n

goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
fix bs :: "bool list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
assume H: "length bs = length xs"
[PROOF STATE]
proof (state)
this:
length bs = length xs

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
with snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
length bs = length xs
[PROOF STEP]
have "list_all (is_alph (Suc n)) (insertll v bs xs)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
length bs = length xs

goal (1 subgoal):
 1. list_all (is_alph (Suc n)) (insertll v bs xs)
[PROOF STEP]
by (simp add: insertll_len2)
[PROOF STATE]
proof (state)
this:
list_all (is_alph (Suc n)) (insertll v bs xs)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
with snoc
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
list_all (is_alph (Suc n)) (insertll v bs xs)
[PROOF STEP]
have "nfa_is_node N (nfa_steps N q (insertll v bs xs))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
list_all (is_alph (Suc n)) (insertll v bs xs)

goal (1 subgoal):
 1. nfa_is_node N (nfa_steps N q (insertll v bs xs))
[PROOF STEP]
by (simp add: nfa_steps_is_node)
[PROOF STATE]
proof (state)
this:
nfa_is_node N (nfa_steps N q (insertll v bs xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
length ?bs2 = length xs \<Longrightarrow> nfa_is_node N (nfa_steps N q (insertll v ?bs2 xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
note N2 = this
[PROOF STATE]
proof (state)
this:
length ?bs2 = length xs \<Longrightarrow> nfa_is_node N (nfa_steps N q (insertll v ?bs2 xs))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = set_of_bv (nfa_steps (quantify_nfa v N) ?q [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = set_of_bv (nfa_trans (quantify_nfa v N) ?q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x]) = set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x]) = set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) [x]) = set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x)

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from snoc N
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)
[PROOF STEP]
have "\<dots> = (\<Union>b. set_of_bv (nfa_trans N ?q (insertl v b x)))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs)))
wf_nfa N (Suc n)
list_all (is_alph n) (xs @ [x])
nfa_is_node N q
v \<le> n
nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)

goal (1 subgoal):
 1. set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x) = (\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x)))
[PROOF STEP]
by (simp add: nfa_trans_quantify_nfa)
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x) = (\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_trans (quantify_nfa v N) (nfa_steps (quantify_nfa v N) q xs) x) = (\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) ?q (nfa_emptybdd (length ?q))) (insertl v b x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x))) = (\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x)))
[PROOF STEP]
by (simp add: nfa_trans_def)
[PROOF STATE]
proof (state)
this:
(\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x))) = (\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>b. set_of_bv (nfa_trans N (nfa_steps (quantify_nfa v N) q xs) (insertl v b x))) = (\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from N B
[PROOF STATE]
proof (chain)
picking this:
nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)
wf_nfa N (length (insertl v ?b x))
[PROOF STEP]
have "\<dots> = (\<Union>b. \<Union>i\<in>set_of_bv ?q. set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))"
[PROOF STATE]
proof (prove)
using this:
nfa_is_node N (nfa_steps (quantify_nfa v N) q xs)
wf_nfa N (length (insertl v ?b x))

goal (1 subgoal):
 1. (\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x))) = (\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))
[PROOF STEP]
by (simp add: subsetbdd_set_of_bv)
[PROOF STATE]
proof (state)
this:
(\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x))) = (\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>b. set_of_bv (bdd_lookup (subsetbdd (fst N) (nfa_steps (quantify_nfa v N) q xs) (nfa_emptybdd (length (nfa_steps (quantify_nfa v N) q xs)))) (insertl v b x))) = (\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from IV
[PROOF STATE]
proof (chain)
picking this:
set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))
[PROOF STEP]
have "\<dots> = (\<Union>b. \<Union>i\<in>(\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs))). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))"
[PROOF STATE]
proof (prove)
using this:
set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)))

goal (1 subgoal):
 1. (\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>i\<in>set_of_bv (nfa_steps (quantify_nfa v N) q xs). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>i\<in>\<Union>x\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v x xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x)))
[PROOF STEP]
by (simp add: UN_UN_lenset)
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>b. \<Union>y\<in>{x. length x = length xs}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v y xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v b x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
from N2 B
[PROOF STATE]
proof (chain)
picking this:
length ?bs2 = length xs \<Longrightarrow> nfa_is_node N (nfa_steps N q (insertll v ?bs2 xs))
wf_nfa N (length (insertl v ?b x))
[PROOF STEP]
have "\<dots> = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x)))" (is "?L = ?R")
[PROOF STATE]
proof (prove)
using this:
length ?bs2 = length xs \<Longrightarrow> nfa_is_node N (nfa_steps N q (insertll v ?bs2 xs))
wf_nfa N (length (insertl v ?b x))

goal (1 subgoal):
 1. (\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x)))
[PROOF STEP]
by (simp add: subsetbdd_set_of_bv[folded nfa_trans_def])
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. \<Union>i\<in>set_of_bv (nfa_steps N q (insertll v (butlast bs) xs)). set_of_bv (bdd_lookup (fst N ! i) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x)))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x])))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x])))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_trans N (nfa_steps N q (insertll v (butlast bs) xs)) (insertl v (last bs) x))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x])))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x]))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))
[PROOF STEP]
by (auto simp: insertll_append)
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x]))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs) xs @ [insertl v (last bs) x]))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
have "\<dots> = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x])))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))
[PROOF STEP]
proof (rule set_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
have "(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) =
      (\<exists>bs \<in> {x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))

goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))

goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
have "\<dots> = (\<exists>bs \<in> {x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x])))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x])))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))

goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x])))) = (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))

goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
have "\<dots> = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>bs\<in>{x. length x = Suc (length xs)}. bs \<noteq> [] \<and> xa \<in> set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))

goal (1 subgoal):
 1. \<And>xa. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
show "(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) =
  (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))"
[PROOF STATE]
proof (prove)
using this:
(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))

goal (1 subgoal):
 1. (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x]))))) = (xa \<in> (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x])))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v (butlast bs @ [last bs]) (xs @ [x])))) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>\<lbrakk>wf_nfa N (Suc n); list_all (is_alph n) xs; nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q xs) = (\<Union>xsa\<in>{x. length x = length xs}. set_of_bv (nfa_steps N q (insertll v xsa xs))); wf_nfa N (Suc n); list_all (is_alph n) (xs @ [x]); nfa_is_node N q; v \<le> n\<rbrakk> \<Longrightarrow> set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>bs\<in>{x. length x = Suc (length xs)}. set_of_bv (nfa_steps N q (insertll v bs (xs @ [x]))))

goal (1 subgoal):
 1. set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_of_bv (nfa_steps (quantify_nfa v N) q (xs @ [x])) = (\<Union>xsa\<in>{xa. length xa = length (xs @ [x])}. set_of_bv (nfa_steps N q (insertll v xsa (xs @ [x]))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_shift: "(\<forall>x::'a::comm_ring_1. P x) \<longleftrightarrow> (\<forall>x. P (x - a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P x) = (\<forall>x. P (x - a))
[PROOF STEP]
by (metis add_diff_cancel)


[STATEMENT]
lemma dist_eq_dist_code_le:
  fixes p\<^sub>0 :: point
  shows "dist p\<^sub>0 p\<^sub>1 \<le> dist p\<^sub>2 p\<^sub>3 \<longleftrightarrow> dist_code p\<^sub>0 p\<^sub>1 \<le> dist_code p\<^sub>2 p\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist (case p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) \<le> dist (case p\<^sub>2 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>3 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y))) = (dist_code p\<^sub>0 p\<^sub>1 \<le> dist_code p\<^sub>2 p\<^sub>3)
[PROOF STEP]
using dist_eq_sqrt_dist_code real_sqrt_le_iff
[PROOF STATE]
proof (prove)
using this:
dist (case ?p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case ?p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) = sqrt (real_of_int (dist_code ?p\<^sub>0 ?p\<^sub>1))
(sqrt ?x \<le> sqrt ?y) = (?x \<le> ?y)

goal (1 subgoal):
 1. (dist (case p\<^sub>0 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>1 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) \<le> dist (case p\<^sub>2 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y)) (case p\<^sub>3 of (x, y) \<Rightarrow> (real_of_int x, real_of_int y))) = (dist_code p\<^sub>0 p\<^sub>1 \<le> dist_code p\<^sub>2 p\<^sub>3)
[PROOF STEP]
by presburger


[STATEMENT]
lemma "y0>0 \<Longrightarrow> test x0 y0 \<le> SPEC (\<lambda>S. S={y0 .. y0 + x0 - 1})"
  \<comment> \<open>Choosen pre-condition to get least trouble when proving\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y0 \<Longrightarrow> test x0 y0 \<le> SPEC (\<lambda>S. S = {y0..y0 + x0 - 1})
[PROOF STEP]
unfolding test_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y0 \<Longrightarrow> (let S = {} in WHILE (\<lambda>(S, x, y). 0 < x) (\<lambda>(S, x, y). let S = S \<union> {y}; x = x - 1 in ASSERT (y < x0 + y0) \<bind> (\<lambda>_. let y = y + 1 in RETURN (S, x, y))) (S, x0, y0) \<bind> (\<lambda>(S, uu_, uu_). RETURN S)) \<le> SPEC (\<lambda>S. S = {y0..y0 + x0 - 1})
[PROOF STEP]
apply (intro WHILE_rule[where I="\<lambda>(S,x,y).
    x+y=x0+y0 \<and> x\<le>x0 \<and>
    S={y0 .. y0 + (x0-x) - 1}"]
    refine_vcg)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. 0 < y0 \<Longrightarrow> case ({}, x0, y0) of (S, xa, y) \<Rightarrow> xa + y = x0 + y0 \<and> xa \<le> x0 \<and> S = {y0..y0 + (x0 - xa) - 1}
 2. \<And>s a b aa ba. \<lbrakk>0 < y0; case s of (S, xa, y) \<Rightarrow> xa + y = x0 + y0 \<and> xa \<le> x0 \<and> S = {y0..y0 + (x0 - xa) - 1}; case s of (S, xa, y) \<Rightarrow> 0 < xa; s = (a, b); b = (aa, ba)\<rbrakk> \<Longrightarrow> ba < x0 + y0
 3. \<And>s a b aa ba. \<lbrakk>0 < y0; case s of (S, xa, y) \<Rightarrow> xa + y = x0 + y0 \<and> xa \<le> x0 \<and> S = {y0..y0 + (x0 - xa) - 1}; case s of (S, xa, y) \<Rightarrow> 0 < xa; s = (a, b); b = (aa, ba); ba < x0 + y0\<rbrakk> \<Longrightarrow> case (a \<union> {ba}, aa - 1, ba + 1) of (S, xa, y) \<Rightarrow> xa + y = x0 + y0 \<and> xa \<le> x0 \<and> S = {y0..y0 + (x0 - xa) - 1}
 4. \<And>s a b aa ba. \<lbrakk>0 < y0; case s of (S, xa, y) \<Rightarrow> xa + y = x0 + y0 \<and> xa \<le> x0 \<and> S = {y0..y0 + (x0 - xa) - 1}; \<not> (case s of (S, xa, y) \<Rightarrow> 0 < xa); s = (a, b); b = (aa, ba)\<rbrakk> \<Longrightarrow> a = {y0..y0 + x0 - 1}
[PROOF STEP]
by auto


[STATEMENT]
lemma inner_mult_left: "inner (of_real m * a) b = m * (inner a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner (of_real m * a) b = m * inner a b
[PROOF STEP]
by (metis real_inner_class.inner_scaleR_left scaleR_conv_of_real)


[STATEMENT]
lemma int_neg_numeral_pOne_conv_not: "- numeral (n + num.One) = (NOT (numeral n) :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - numeral (n + num.One) = NOT (numeral n)
[PROOF STEP]
by(simp add: int_not_def)


[STATEMENT]
lemma (in group) infinite_cyclic_subgroup_order:
   "x \<in> carrier G \<Longrightarrow> infinite (carrier(subgroup_generated G {x})) \<longleftrightarrow> ord x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> infinite (carrier (subgroup_generated G {x})) = (ord x = 0)
[PROOF STEP]
by (simp add: finite_cyclic_subgroup_order)


[STATEMENT]
lemma "(\<lambda>x::real. exp (sin x) / ln (cos x)) \<sim>[at 0] (\<lambda>x. -2 / x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. exp (sin x) / ln (cos x)) \<sim>[at 0] (\<lambda>x. - 2 / x\<^sup>2)
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma ODNmap_self:"\<lbrakk>Worder D; c \<in> carrier D;
       a = ordinal_number (Iod D (segment D c))\<rbrakk> \<Longrightarrow> ODNmap D a = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c))\<rbrakk> \<Longrightarrow> ODNmap D a = c
[PROOF STEP]
apply (simp add:ODNmap_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c))\<rbrakk> \<Longrightarrow> (SOME z. z \<in> carrier D \<and> (\<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D z)))) = c
[PROOF STEP]
apply (rule someI2_ex, rule ex_conjI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c))\<rbrakk> \<Longrightarrow> \<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D c))
 2. \<And>x. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c)); x \<in> carrier D \<and> (\<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D x)))\<rbrakk> \<Longrightarrow> x = c
[PROOF STEP]
apply (rule ballI,
        cut_tac Worder.segment_Worder[of "D" "c"],
        rule_tac X = Y in mem_ordinal_number_equiv[of "Iod D (segment D c)"],
        assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c)); x \<in> carrier D \<and> (\<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D x)))\<rbrakk> \<Longrightarrow> x = c
[PROOF STEP]
apply (erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c)); x \<in> carrier D; \<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D x))\<rbrakk> \<Longrightarrow> x = c
[PROOF STEP]
apply (cut_tac Worder.segment_Worder[of "D" "c"],
        frule ordinal_inc_self[of "Iod D (segment D c)"],
        frule_tac x = "Iod D (segment D c)" in bspec, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c)); x \<in> carrier D; \<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D x)); Worder (Iod D (segment D c)); Iod D (segment D c) \<in> ordinal_number (Iod D (segment D c)); ord_equiv (Iod D (segment D c)) (Iod D (segment D x))\<rbrakk> \<Longrightarrow> x = c
 2. \<And>x. \<lbrakk>Worder D; c \<in> carrier D; a = ordinal_number (Iod D (segment D c)); x \<in> carrier D; \<forall>Y\<in>ordinal_number (Iod D (segment D c)). ord_equiv Y (Iod D (segment D x))\<rbrakk> \<Longrightarrow> Worder D
[PROOF STEP]
apply (frule_tac b = x in Worder.segment_unique[of "D" "c" _], assumption+,
        rule sym, assumption, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done