[STATEMENT]
lemma pre_dfs_implies_post_dfs:
  fixes v e
  defines "e1 \<equiv> e\<lparr>visited := visited e \<union> {v},
                  stack := (v # stack e),
                  cstack:=(v # cstack e)\<rparr>"
  defines "e' \<equiv> dfss v e1"
  defines "e'' \<equiv> e'\<lparr> cstack := tl(cstack e')\<rparr>"
  assumes 1: "pre_dfs v e"
      and 2: "dfs_dfss_dom (Inl(v, e))"
      and 3: "post_dfss v e1 e'"
  shows "post_dfs v e (dfs v e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
[PROOF STEP]
have wf: "wf_env e"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e

goal (1 subgoal):
 1. wf_env e
[PROOF STEP]
by (simp add: pre_dfs_def)
[PROOF STATE]
proof (state)
this:
wf_env e

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
[PROOF STEP]
have v: "v \<notin> visited e"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e

goal (1 subgoal):
 1. v \<notin> visited e
[PROOF STEP]
by (simp add: pre_dfs_def)
[PROOF STATE]
proof (state)
this:
v \<notin> visited e

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have wf': "wf_env e'"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. wf_env e'
[PROOF STEP]
by (simp add: post_dfss_def)
[PROOF STATE]
proof (state)
this:
wf_env e'

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have cst': "cstack e' = v # cstack e"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. cstack e' = v # cstack e
[PROOF STEP]
by (simp add: post_dfss_def e1_def)
[PROOF STATE]
proof (state)
this:
cstack e' = v # cstack e

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
proof (cases "v = hd(stack e')")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
v = hd (stack e')

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have notempty: "stack e' = v # stack e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stack e' = v # stack e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. stack e' = v # stack e
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
obtain ns where
        ns: "stack e1 = ns @ (stack e')" "stack e' \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. (\<And>ns. \<lbrakk>stack e1 = ns @ stack e'; stack e' \<noteq> []\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: post_dfss_def)
[PROOF STATE]
proof (state)
this:
stack e1 = ns @ stack e'
stack e' \<noteq> []

goal (1 subgoal):
 1. stack e' = v # stack e
[PROOF STEP]
have "ns = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ns = []
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ns \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
assume "ns \<noteq> []"
[PROOF STATE]
proof (state)
this:
ns \<noteq> []

goal (1 subgoal):
 1. ns \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
with ns
[PROOF STATE]
proof (chain)
picking this:
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns \<noteq> []
[PROOF STEP]
have "hd ns = v"
[PROOF STATE]
proof (prove)
using this:
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns \<noteq> []

goal (1 subgoal):
 1. hd ns = v
[PROOF STEP]
apply (simp add: e1_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v # stack e = ns @ stack e'; stack e' \<noteq> []; ns \<noteq> []\<rbrakk> \<Longrightarrow> hd ns = v
[PROOF STEP]
by (metis hd_append2 list.sel(1))
[PROOF STATE]
proof (state)
this:
hd ns = v

goal (1 subgoal):
 1. ns \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
with True ns \<open>ns \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
v = hd (stack e')
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns \<noteq> []
hd ns = v
[PROOF STEP]
have "\<not> distinct (stack e1)"
[PROOF STATE]
proof (prove)
using this:
v = hd (stack e')
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns \<noteq> []
hd ns = v

goal (1 subgoal):
 1. \<not> distinct (stack e1)
[PROOF STEP]
by (metis disjoint_iff_not_equal distinct_append hd_in_set)
[PROOF STATE]
proof (state)
this:
\<not> distinct (stack e1)

goal (1 subgoal):
 1. ns \<noteq> [] \<Longrightarrow> False
[PROOF STEP]
with wf v stack_visited[OF wf]
[PROOF STATE]
proof (chain)
picking this:
wf_env e
v \<notin> visited e
?n \<in> set (stack e) \<Longrightarrow> ?n \<in> visited e
\<not> distinct (stack e1)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
wf_env e
v \<notin> visited e
?n \<in> set (stack e) \<Longrightarrow> ?n \<in> visited e
\<not> distinct (stack e1)

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp: wf_env_def e1_def)
[PROOF STATE]
proof (state)
this:
False

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

goal (1 subgoal):
 1. stack e' = v # stack e
[PROOF STEP]
with ns
[PROOF STATE]
proof (chain)
picking this:
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns = []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
stack e1 = ns @ stack e'
stack e' \<noteq> []
ns = []

goal (1 subgoal):
 1. stack e' = v # stack e
[PROOF STEP]
by (simp add: e1_def)
[PROOF STATE]
proof (state)
this:
stack e' = v # stack e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
stack e' = v # stack e

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have e2: "dfs v e = e'\<lparr>sccs := sccs e' \<union> {\<S> e' v},
                           explored := explored e' \<union> (\<S> e' v),
                           stack := tl (stack e'),
                           cstack := tl (cstack e')\<rparr>" (is "_ = ?e2")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfs v e = e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>
[PROOF STEP]
using True 2 dfs.psimps[of v e]
[PROOF STATE]
proof (prove)
using this:
v = hd (stack e')
dfs_dfss_dom (Inl (v, e))
dfs_dfss_dom (Inl (v, e)) \<Longrightarrow> dfs v e = (let e1 = e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>; e' = dfss v e1 in if v = hd (stack e') then e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr> else e'\<lparr>cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. dfs v e = e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>
[PROOF STEP]
unfolding e1_def e'_def
[PROOF STATE]
proof (prove)
using this:
v = hd (stack (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)))
dfs_dfss_dom (Inl (v, e))
dfs_dfss_dom (Inl (v, e)) \<Longrightarrow> dfs v e = (let e1 = e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>; e' = dfss v e1 in if v = hd (stack e') then e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr> else e'\<lparr>cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. dfs v e = dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)\<lparr>sccs := sccs (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)) \<union> {\<S> (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)) v}, explored := explored (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)) \<union> \<S> (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)) v, stack := tl (stack (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>))), cstack := tl (cstack (dfss v (e\<lparr>visited := visited e \<union> {v}, stack := v # stack e, cstack := v # cstack e\<rparr>)))\<rparr>
[PROOF STEP]
by (fastforce simp: e1_def e'_def)
[PROOF STATE]
proof (state)
this:
dfs v e = e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have sub: "sub_env e e1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_env e e1
[PROOF STEP]
by (auto simp: sub_env_def e1_def)
[PROOF STATE]
proof (state)
this:
sub_env e e1

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from notempty
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
[PROOF STEP]
have stack2: "stack ?e2 = stack e"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e

goal (1 subgoal):
 1. stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
[PROOF STEP]
by (simp add: e1_def)
[PROOF STATE]
proof (state)
this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "v \<in> visited ?e2"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (auto simp: post_dfss_def sub_env_def e1_def)
[PROOF STATE]
proof (state)
this:
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from sub 3
[PROOF STATE]
proof (chain)
picking this:
sub_env e e1
post_dfss v e1 e'
[PROOF STEP]
have "sub_env e e'"
[PROOF STATE]
proof (prove)
using this:
sub_env e e1
post_dfss v e1 e'

goal (1 subgoal):
 1. sub_env e e'
[PROOF STEP]
unfolding post_dfss_def
[PROOF STATE]
proof (prove)
using this:
sub_env e e1
wf_env e' \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e1 - {v}. vsuccs e' w = vsuccs e1 w) \<and> sub_env e1 e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<union> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. stack e1 = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e1 n) \<and> (hd (stack e') = v \<longrightarrow> (\<forall>n\<in>set (tl (stack e')). \<not> reachable v n)) \<and> cstack e' = cstack e1

goal (1 subgoal):
 1. sub_env e e'
[PROOF STEP]
by (auto elim: sub_env_trans)
[PROOF STATE]
proof (state)
this:
sub_env e e'

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
with stack2
[PROOF STATE]
proof (chain)
picking this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
sub_env e e'
[PROOF STEP]
have subenv: "sub_env e ?e2"
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
sub_env e e'

goal (1 subgoal):
 1. sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (fastforce simp: sub_env_def)
[PROOF STATE]
proof (state)
this:
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have "wf_env ?e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from wf'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
[PROOF STEP]
have "\<forall>n \<in> visited ?e2. reachable (root ?e2) n"
           "distinct (stack ?e2)"
           "\<forall>n. vsuccs ?e2 n \<subseteq> successors n \<inter> visited ?e2"
           "\<forall>n. n \<notin> visited ?e2 \<longrightarrow> vsuccs ?e2 n = {}"
           "\<forall>n m. m \<in> \<S> ?e2 n \<longleftrightarrow> (\<S> ?e2 n = \<S> ?e2 m)"
           "\<forall>n. n \<notin> visited ?e2 \<longrightarrow> \<S> ?e2 n = {n}"
           "\<forall>n. is_subscc (\<S> ?e2 n)"
           "\<Union> (sccs ?e2) = explored ?e2"
[PROOF STATE]
proof (prove)
using this:
wf_env e'

goal (1 subgoal):
 1. ((\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n &&& distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))) &&& \<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) &&& \<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}) &&& (\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m) &&& \<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}) &&& \<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) &&& \<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (auto simp: wf_env_def distinct_tl)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n
distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}
\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}
\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)
\<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n
distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}
\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}
\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)
\<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from 1 cst'
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
cstack e' = v # cstack e
[PROOF STEP]
have "distinct (cstack ?e2)"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e
cstack e' = v # cstack e

goal (1 subgoal):
 1. distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
[PROOF STEP]
by (auto simp: pre_dfs_def wf_env_def)
[PROOF STATE]
proof (state)
this:
distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from 1 stack2
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
[PROOF STEP]
have "\<forall>n m. n \<preceq> m in stack ?e2 \<longrightarrow> reachable m n"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e

goal (1 subgoal):
 1. \<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n
[PROOF STEP]
by (auto simp: pre_dfs_def wf_env_def)
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from 1 stack2 cst'
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
cstack e' = v # cstack e
[PROOF STEP]
have "\<forall>n m. n \<preceq> m in stack ?e2 \<longrightarrow> n \<preceq> m in cstack ?e2"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
cstack e' = v # cstack e

goal (1 subgoal):
 1. \<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (auto simp: pre_dfs_def wf_env_def)
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from notempty wf'
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
wf_env e'
[PROOF STEP]
have "explored ?e2 \<subseteq> visited ?e2"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e
wf_env e'

goal (1 subgoal):
 1. explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
apply (simp add: wf_env_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>stack e' = v # stack e; (\<forall>n\<in>visited e'. reachable (root e') n) \<and> v \<notin> set (stack e) \<and> distinct (stack e) \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<and> vsuccs e' n \<subseteq> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>m\<in>set (stack e). v \<noteq> m \<longrightarrow> \<S> e' v \<inter> \<S> e' m = {}) \<and> (\<forall>n\<in>set (stack e). (n \<noteq> v \<longrightarrow> \<S> e' n \<inter> \<S> e' v = {}) \<and> (\<forall>m\<in>set (stack e). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {})) \<and> \<Union> {\<S> e' n |n. n = v \<or> n \<in> set (stack e)} = visited e' - explored e' \<and> (\<forall>m\<in>\<S> e' v. m \<in> set (cstack e') \<longrightarrow> m \<preceq> v in cstack e') \<and> (\<forall>n\<in>set (stack e). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e'\<rbrakk> \<Longrightarrow> \<S> e' v \<subseteq> visited e'
[PROOF STEP]
using stack_class[OF wf']
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?n \<in> set (stack e'); ?m \<in> \<S> e' ?n\<rbrakk> \<Longrightarrow> ?m \<in> visited e' - explored e'

goal (1 subgoal):
 1. \<lbrakk>stack e' = v # stack e; (\<forall>n\<in>visited e'. reachable (root e') n) \<and> v \<notin> set (stack e) \<and> distinct (stack e) \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<and> vsuccs e' n \<subseteq> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>m\<in>set (stack e). v \<noteq> m \<longrightarrow> \<S> e' v \<inter> \<S> e' m = {}) \<and> (\<forall>n\<in>set (stack e). (n \<noteq> v \<longrightarrow> \<S> e' n \<inter> \<S> e' v = {}) \<and> (\<forall>m\<in>set (stack e). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {})) \<and> \<Union> {\<S> e' n |n. n = v \<or> n \<in> set (stack e)} = visited e' - explored e' \<and> (\<forall>m\<in>\<S> e' v. m \<in> set (cstack e') \<longrightarrow> m \<preceq> v in cstack e') \<and> (\<forall>n\<in>set (stack e). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in (v # stack e) \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e'\<rbrakk> \<Longrightarrow> \<S> e' v \<subseteq> visited e'
[PROOF STEP]
by (smt (verit, del_insts) Diff_iff insert_subset list.simps(15) subset_eq)
[PROOF STATE]
proof (state)
this:
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from 3 cst'
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
cstack e' = v # cstack e
[PROOF STEP]
have "set (cstack ?e2) \<subseteq> visited ?e2"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
cstack e' = v # cstack e

goal (1 subgoal):
 1. set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (simp add: post_dfss_def wf_env_def e1_def)
[PROOF STATE]
proof (state)
this:
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
assume "u \<in> explored ?e2"
[PROOF STATE]
proof (state)
this:
u \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "vsuccs ?e2 u = successors u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
proof (cases "u \<in> explored e'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
 2. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u \<in> explored e'

goal (2 subgoals):
 1. u \<in> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
 2. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
with wf'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
u \<in> explored e'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wf_env e'
u \<in> explored e'

goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u

goal (1 subgoal):
 1. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
u \<notin> explored e'

goal (1 subgoal):
 1. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
with \<open>u \<in> explored ?e2\<close>
[PROOF STATE]
proof (chain)
picking this:
u \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
u \<notin> explored e'
[PROOF STEP]
have "u \<in> \<S> e' v"
[PROOF STATE]
proof (prove)
using this:
u \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
u \<notin> explored e'

goal (1 subgoal):
 1. u \<in> \<S> e' v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u \<in> \<S> e' v

goal (1 subgoal):
 1. u \<notin> explored e' \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
proof (cases "u = v")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u = v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
 2. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
u = v

goal (2 subgoals):
 1. u = v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
 2. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
u = v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
u = v

goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
by (auto simp: post_dfss_def)
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u

goal (1 subgoal):
 1. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
u \<noteq> v

goal (1 subgoal):
 1. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
have "u \<in> visited e' - set (cstack e')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> visited e' - set (cstack e')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. u \<in> visited e'
 2. u \<notin> set (cstack e')
[PROOF STEP]
from notempty \<open>u \<in> \<S> e' v\<close> stack_class[OF wf'] False
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
u \<in> \<S> e' v
\<lbrakk>?n \<in> set (stack e'); ?m \<in> \<S> e' ?n\<rbrakk> \<Longrightarrow> ?m \<in> visited e' - explored e'
u \<noteq> v
[PROOF STEP]
show "u \<in> visited e'"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e
u \<in> \<S> e' v
\<lbrakk>?n \<in> set (stack e'); ?m \<in> \<S> e' ?n\<rbrakk> \<Longrightarrow> ?m \<in> visited e' - explored e'
u \<noteq> v

goal (1 subgoal):
 1. u \<in> visited e'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> visited e'

goal (1 subgoal):
 1. u \<notin> set (cstack e')
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<notin> set (cstack e')
[PROOF STEP]
show "u \<notin> set (cstack e')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<notin> set (cstack e')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. u \<in> set (cstack e') \<Longrightarrow> False
[PROOF STEP]
assume u: "u \<in> set (cstack e')"
[PROOF STATE]
proof (state)
this:
u \<in> set (cstack e')

goal (1 subgoal):
 1. u \<in> set (cstack e') \<Longrightarrow> False
[PROOF STEP]
with notempty \<open>u \<in> \<S> e' v\<close> \<open>wf_env e'\<close>
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
u \<in> \<S> e' v
wf_env e'
u \<in> set (cstack e')
[PROOF STEP]
have "u \<preceq> v in cstack e'"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e
u \<in> \<S> e' v
wf_env e'
u \<in> set (cstack e')

goal (1 subgoal):
 1. u \<preceq> v in cstack e'
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
u \<preceq> v in cstack e'

goal (1 subgoal):
 1. u \<in> set (cstack e') \<Longrightarrow> False
[PROOF STEP]
with cst' u False wf'
[PROOF STATE]
proof (chain)
picking this:
cstack e' = v # cstack e
u \<in> set (cstack e')
u \<noteq> v
wf_env e'
u \<preceq> v in cstack e'
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
cstack e' = v # cstack e
u \<in> set (cstack e')
u \<noteq> v
wf_env e'
u \<preceq> v in cstack e'

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding wf_env_def
[PROOF STATE]
proof (prove)
using this:
cstack e' = v # cstack e
u \<in> set (cstack e')
u \<noteq> v
(\<forall>n\<in>visited e'. reachable (root e') n) \<and> distinct (stack e') \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<inter> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e'
u \<preceq> v in cstack e'

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u \<notin> set (cstack e')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u \<in> visited e' - set (cstack e')

goal (1 subgoal):
 1. u \<noteq> v \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
u \<in> visited e' - set (cstack e')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
u \<in> visited e' - set (cstack e')

goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u
[PROOF STEP]
by (auto simp: post_dfss_def wf_env_def)
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) u = successors u

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
note explored_vsuccs = this
[PROOF STATE]
proof (state)
this:
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "\<forall>n \<in> explored ?e2. \<forall>m. reachable n m \<longrightarrow> m \<in> explored ?e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); reachable n m\<rbrakk> \<Longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); reachable n m\<rbrakk> \<Longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
assume asm: "x \<in> explored ?e2" "reachable x y"
[PROOF STATE]
proof (state)
this:
x \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
reachable x y

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); reachable n m\<rbrakk> \<Longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
show "y \<in> explored ?e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof (cases "x \<in> explored e'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> explored e'

goal (2 subgoals):
 1. x \<in> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with \<open>wf_env e'\<close> \<open>reachable x y\<close>
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
reachable x y
x \<in> explored e'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
wf_env e'
reachable x y
x \<in> explored e'

goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (simp add: wf_env_def)
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> explored e'

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with asm
[PROOF STATE]
proof (chain)
picking this:
x \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
reachable x y
x \<notin> explored e'
[PROOF STEP]
have "x \<in> \<S> e' v"
[PROOF STATE]
proof (prove)
using this:
x \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
reachable x y
x \<notin> explored e'

goal (1 subgoal):
 1. x \<in> \<S> e' v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> \<S> e' v

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with \<open>explored ?e2 \<subseteq> visited ?e2\<close>
[PROOF STATE]
proof (chain)
picking this:
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
x \<in> \<S> e' v
[PROOF STEP]
have "x \<in> visited e'"
[PROOF STATE]
proof (prove)
using this:
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
x \<in> \<S> e' v

goal (1 subgoal):
 1. x \<in> visited e'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> visited e'

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from \<open>x \<in> \<S> e' v\<close> wf'
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<S> e' v
wf_env e'
[PROOF STEP]
have "reachable v x"
[PROOF STATE]
proof (prove)
using this:
x \<in> \<S> e' v
wf_env e'

goal (1 subgoal):
 1. reachable v x
[PROOF STEP]
by (auto simp: wf_env_def is_subscc_def)
[PROOF STATE]
proof (state)
this:
reachable v x

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "y \<in> visited e'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> visited e'
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
assume "y \<notin> visited e'"
[PROOF STATE]
proof (state)
this:
y \<notin> visited e'

goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
with reachable_visited[OF wf' \<open>x \<in> visited e'\<close> \<open>reachable x y\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<in>visited e'. \<forall>m\<in>successors n - vsuccs e' n. reachable x n \<longrightarrow> \<not> reachable m y \<Longrightarrow> y \<in> visited e'
y \<notin> visited e'
[PROOF STEP]
obtain n m where
              "n \<in> visited e'" "m \<in> successors n - vsuccs e' n"
              "reachable x n" "reachable m y"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>visited e'. \<forall>m\<in>successors n - vsuccs e' n. reachable x n \<longrightarrow> \<not> reachable m y \<Longrightarrow> y \<in> visited e'
y \<notin> visited e'

goal (1 subgoal):
 1. (\<And>n m. \<lbrakk>n \<in> visited e'; m \<in> successors n - vsuccs e' n; reachable x n; reachable m y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n \<in> visited e'
m \<in> successors n - vsuccs e' n
reachable x n
reachable m y

goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
from wf' \<open>m \<in> successors n - vsuccs e' n\<close>
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
m \<in> successors n - vsuccs e' n
[PROOF STEP]
have "n \<notin> explored e'"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
m \<in> successors n - vsuccs e' n

goal (1 subgoal):
 1. n \<notin> explored e'
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
n \<notin> explored e'

goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
obtain n' where
              "n' \<in> set (stack e')" "n \<in> \<S> e' n'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n'. \<lbrakk>n' \<in> set (stack e'); n \<in> \<S> e' n'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule visited_unexplored[OF wf' \<open>n \<in> visited e'\<close> \<open>n \<notin> explored e'\<close>])
[PROOF STATE]
proof (state)
this:
n' \<in> set (stack e')
n \<in> \<S> e' n'

goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
have "n' = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n' = v
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
assume "n' \<noteq> v"
[PROOF STATE]
proof (state)
this:
n' \<noteq> v

goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
with \<open>n' \<in> set (stack e')\<close> \<open>v = hd (stack e')\<close>
[PROOF STATE]
proof (chain)
picking this:
n' \<in> set (stack e')
v = hd (stack e')
n' \<noteq> v
[PROOF STEP]
have "n' \<in> set (tl (stack e'))"
[PROOF STATE]
proof (prove)
using this:
n' \<in> set (stack e')
v = hd (stack e')
n' \<noteq> v

goal (1 subgoal):
 1. n' \<in> set (tl (stack e'))
[PROOF STEP]
by (metis emptyE hd_Cons_tl set_ConsD set_empty)
[PROOF STATE]
proof (state)
this:
n' \<in> set (tl (stack e'))

goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n' \<in> set (tl (stack e'))

goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
from \<open>n \<in> \<S> e' n'\<close> \<open>wf_env e'\<close>
[PROOF STATE]
proof (chain)
picking this:
n \<in> \<S> e' n'
wf_env e'
[PROOF STEP]
have "reachable n n'"
[PROOF STATE]
proof (prove)
using this:
n \<in> \<S> e' n'
wf_env e'

goal (1 subgoal):
 1. reachable n n'
[PROOF STEP]
by (auto simp: wf_env_def is_subscc_def)
[PROOF STATE]
proof (state)
this:
reachable n n'

goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
with \<open>reachable v x\<close> \<open>reachable x n\<close> reachable_trans
[PROOF STATE]
proof (chain)
picking this:
reachable v x
reachable x n
\<lbrakk>reachable ?x ?y; reachable ?y ?z\<rbrakk> \<Longrightarrow> reachable ?x ?z
reachable n n'
[PROOF STEP]
have "reachable v n'"
[PROOF STATE]
proof (prove)
using this:
reachable v x
reachable x n
\<lbrakk>reachable ?x ?y; reachable ?y ?z\<rbrakk> \<Longrightarrow> reachable ?x ?z
reachable n n'

goal (1 subgoal):
 1. reachable v n'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
reachable v n'

goal (1 subgoal):
 1. n' \<noteq> v \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n' \<in> set (tl (stack e'))
reachable v n'
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
n' \<in> set (tl (stack e'))
reachable v n'

goal (1 subgoal):
 1. False
[PROOF STEP]
using 3 \<open>v = hd (stack e')\<close>
[PROOF STATE]
proof (prove)
using this:
n' \<in> set (tl (stack e'))
reachable v n'
post_dfss v e1 e'
v = hd (stack e')

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n' = v

goal (1 subgoal):
 1. y \<notin> visited e' \<Longrightarrow> False
[PROOF STEP]
with \<open>n \<in> \<S> e' n'\<close> \<open>m \<in> successors n - vsuccs e' n\<close> explored_vsuccs
[PROOF STATE]
proof (chain)
picking this:
n \<in> \<S> e' n'
m \<in> successors n - vsuccs e' n
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8
n' = v
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
n \<in> \<S> e' n'
m \<in> successors n - vsuccs e' n
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8
n' = v

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> visited e'

goal (1 subgoal):
 1. x \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof (cases "y \<in> explored e'")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<in> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<in> explored e'

goal (2 subgoals):
 1. y \<in> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> explored e'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y \<in> explored e'

goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y \<notin> explored e'

goal (1 subgoal):
 1. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
obtain n where ndef: "n \<in> set (stack e')" "(y \<in> \<S> e' n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<in> set (stack e'); y \<in> \<S> e' n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule visited_unexplored[OF wf' \<open>y \<in> visited e'\<close> False])
[PROOF STATE]
proof (state)
this:
n \<in> set (stack e')
y \<in> \<S> e' n

goal (1 subgoal):
 1. y \<notin> explored e' \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof (cases "n = v")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = v

goal (2 subgoals):
 1. n = v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
 2. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with ndef
[PROOF STATE]
proof (chain)
picking this:
n \<in> set (stack e')
y \<in> \<S> e' n
n = v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<in> set (stack e')
y \<in> \<S> e' n
n = v

goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> v

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with ndef notempty
[PROOF STATE]
proof (chain)
picking this:
n \<in> set (stack e')
y \<in> \<S> e' n
stack e' = v # stack e
n \<noteq> v
[PROOF STEP]
have "n \<in> set (tl (stack e'))"
[PROOF STATE]
proof (prove)
using this:
n \<in> set (stack e')
y \<in> \<S> e' n
stack e' = v # stack e
n \<noteq> v

goal (1 subgoal):
 1. n \<in> set (tl (stack e'))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<in> set (tl (stack e'))

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n \<in> set (tl (stack e'))

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from wf' ndef
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
n \<in> set (stack e')
y \<in> \<S> e' n
[PROOF STEP]
have "reachable y n"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
n \<in> set (stack e')
y \<in> \<S> e' n

goal (1 subgoal):
 1. reachable y n
[PROOF STEP]
by (auto simp: wf_env_def is_subscc_def)
[PROOF STATE]
proof (state)
this:
reachable y n

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with \<open>reachable v x\<close> \<open>reachable x y\<close>
[PROOF STATE]
proof (chain)
picking this:
reachable v x
reachable x y
reachable y n
[PROOF STEP]
have "reachable v n"
[PROOF STATE]
proof (prove)
using this:
reachable v x
reachable x y
reachable y n

goal (1 subgoal):
 1. reachable v n
[PROOF STEP]
by (meson reachable_trans)
[PROOF STATE]
proof (state)
this:
reachable v n

goal (1 subgoal):
 1. n \<noteq> v \<Longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n \<in> set (tl (stack e'))
reachable v n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<in> set (tl (stack e'))
reachable v n

goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
using \<open>v = hd (stack e')\<close> 3
[PROOF STATE]
proof (prove)
using this:
n \<in> set (tl (stack e'))
reachable v n
v = hd (stack e')
post_dfss v e1 e'

goal (1 subgoal):
 1. y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (simp add: post_dfss_def)
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from 3 cst'
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
cstack e' = v # cstack e
[PROOF STEP]
have "\<forall>n \<in> visited ?e2 - set (cstack ?e2). vsuccs ?e2 n = successors n"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
cstack e' = v # cstack e

goal (1 subgoal):
 1. \<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n
[PROOF STEP]
apply (simp add: post_dfss_def wf_env_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<forall>x\<in>visited e'. reachable (root e') x) \<and> distinct (stack e') \<and> v \<notin> set (cstack e) \<and> distinct (cstack e) \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in (v # cstack e)) \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> v \<in> visited e' \<and> set (cstack e) \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<and> vsuccs e' n \<subseteq> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - insert v (set (cstack e)). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. (m = v \<longrightarrow> v \<preceq> n in (v # cstack e)) \<and> (m \<in> set (cstack e) \<longrightarrow> m \<preceq> n in (v # cstack e))) \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e' \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e1 - {v}. vsuccs e' w = vsuccs e1 w) \<and> sub_env e1 e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<or> w \<in> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. stack e1 = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e1 n) \<and> (hd (stack e') = v \<longrightarrow> (\<forall>n\<in>set (tl (stack e')). \<not> reachable v n)) \<and> v # cstack e = cstack e1; cstack e' = cstack e1\<rbrakk> \<Longrightarrow> \<forall>n\<in>visited e' - set (tl (cstack e1)). vsuccs e' n = successors n
[PROOF STEP]
by (metis (no_types, lifting) Diff_empty Diff_iff empty_set insertE
                  list.exhaust_sel list.sel(1) list.simps(15))
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from wf' notempty
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
stack e' = v # stack e
[PROOF STEP]
have "\<forall>n m. n \<in> set (stack ?e2) \<and> m \<in> set (stack ?e2) \<and> n \<noteq> m
                  \<longrightarrow> (\<S> ?e2 n \<inter> \<S> ?e2 m = {})"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
stack e' = v # stack e

goal (1 subgoal):
 1. \<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}
[PROOF STEP]
by (simp add: wf_env_def)
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "\<Union> {\<S> ?e2 n | n . n \<in> set (stack ?e2)} = visited ?e2 - explored ?e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from wf' notempty
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
stack e' = v # stack e
[PROOF STEP]
have "(\<Union> {\<S> ?e2 n | n . n \<in> set (stack ?e2)}) \<inter> \<S> e' v = {}"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
stack e' = v # stack e

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} \<inter> \<S> e' v = {}
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} \<inter> \<S> e' v = {}

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with notempty
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} \<inter> \<S> e' v = {}
[PROOF STEP]
have "\<Union> {\<S> ?e2 n | n . n \<in> set (stack ?e2)} =
              (\<Union> {\<S> e' n | n . n \<in> set (stack e')}) - \<S> e' v"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} \<inter> \<S> e' v = {}

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = \<Union> {\<S> e' n |n. n \<in> set (stack e')} - \<S> e' v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = \<Union> {\<S> e' n |n. n \<in> set (stack e')} - \<S> e' v

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = \<Union> {\<S> e' n |n. n \<in> set (stack e')} - \<S> e' v

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from wf'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
[PROOF STEP]
have "\<dots> = (visited e' - explored e') - \<S> e' v"
[PROOF STATE]
proof (prove)
using this:
wf_env e'

goal (1 subgoal):
 1. \<Union> {\<S> e' n |n. n \<in> set (stack e')} - \<S> e' v = visited e' - explored e' - \<S> e' v
[PROOF STEP]
by (simp add: wf_env_def)
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> e' n |n. n \<in> set (stack e')} - \<S> e' v = visited e' - explored e' - \<S> e' v

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited e' - explored e' - \<S> e' v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited e' - explored e' - \<S> e' v

goal (1 subgoal):
 1. \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "\<forall>n \<in> set (stack ?e2). \<forall>m \<in> \<S> ?e2 n. m \<in> set (cstack ?e2) \<longrightarrow> m \<preceq> n in cstack ?e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
proof (clarsimp simp: cst')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (tl (stack e')); m \<in> \<S> e' n; m \<in> set (cstack e)\<rbrakk> \<Longrightarrow> m \<preceq> n in cstack e
[PROOF STEP]
fix n m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (tl (stack e')); m \<in> \<S> e' n; m \<in> set (cstack e)\<rbrakk> \<Longrightarrow> m \<preceq> n in cstack e
[PROOF STEP]
assume "n \<in> set (tl (stack e'))"
               "m \<in> \<S> e' n" "m \<in> set (cstack e)"
[PROOF STATE]
proof (state)
this:
n \<in> set (tl (stack e'))
m \<in> \<S> e' n
m \<in> set (cstack e)

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (tl (stack e')); m \<in> \<S> e' n; m \<in> set (cstack e)\<rbrakk> \<Longrightarrow> m \<preceq> n in cstack e
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
n \<in> set (tl (stack e'))
m \<in> \<S> e' n
m \<in> set (cstack e)
[PROOF STEP]
have "m \<in> \<S> e n"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
n \<in> set (tl (stack e'))
m \<in> \<S> e' n
m \<in> set (cstack e)

goal (1 subgoal):
 1. m \<in> \<S> e n
[PROOF STEP]
by (auto simp: post_dfss_def e1_def)
[PROOF STATE]
proof (state)
this:
m \<in> \<S> e n

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (tl (stack e')); m \<in> \<S> e' n; m \<in> set (cstack e)\<rbrakk> \<Longrightarrow> m \<preceq> n in cstack e
[PROOF STEP]
with wf notempty \<open>n \<in> set (tl (stack e'))\<close> \<open>m \<in> set (cstack e)\<close>
[PROOF STATE]
proof (chain)
picking this:
wf_env e
stack e' = v # stack e
n \<in> set (tl (stack e'))
m \<in> set (cstack e)
m \<in> \<S> e n
[PROOF STEP]
show "m \<preceq> n in cstack e"
[PROOF STATE]
proof (prove)
using this:
wf_env e
stack e' = v # stack e
n \<in> set (tl (stack e'))
m \<in> set (cstack e)
m \<in> \<S> e n

goal (1 subgoal):
 1. m \<preceq> n in cstack e
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
m \<preceq> n in cstack e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
fix x y u
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
assume xy: "x \<preceq> y in stack ?e2" "x \<noteq> y"
           and u: "u \<in> \<S> ?e2 x" "reachable_avoiding u y (unvisited ?e2 x)"
[PROOF STATE]
proof (state)
this:
x \<preceq> y in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
x \<noteq> y
u \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x
reachable_avoiding u y (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x)

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
from xy notempty stack2
[PROOF STATE]
proof (chain)
picking this:
x \<preceq> y in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
x \<noteq> y
stack e' = v # stack e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
[PROOF STEP]
have "x \<preceq> y in stack e'"
[PROOF STATE]
proof (prove)
using this:
x \<preceq> y in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
x \<noteq> y
stack e' = v # stack e
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e

goal (1 subgoal):
 1. x \<preceq> y in stack e'
[PROOF STEP]
by (metis head_precedes insert_iff list.simps(15) precedes_in_tail precedes_mem(2))
[PROOF STATE]
proof (state)
this:
x \<preceq> y in stack e'

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
with wf' \<open>x \<noteq> y\<close> u
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
x \<noteq> y
u \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x
reachable_avoiding u y (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x)
x \<preceq> y in stack e'
[PROOF STEP]
have "False"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
x \<noteq> y
u \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x
reachable_avoiding u y (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) x)
x \<preceq> y in stack e'

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto simp: wf_env_def unvisited_def)
[PROOF STATE]
proof (state)
this:
False

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x8 \<preceq> ?y8 in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); ?x8 \<noteq> ?y8; ?u8 \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8; reachable_avoiding ?u8 ?y8 (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x8 \<preceq> ?y8 in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); ?x8 \<noteq> ?y8; ?u8 \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8; reachable_avoiding ?u8 ?y8 (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "\<forall>S \<in> sccs ?e2. is_scc S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> is_scc S
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> is_scc S
[PROOF STEP]
assume asm: "S \<in> sccs ?e2"
[PROOF STATE]
proof (state)
this:
S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. \<And>S. S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> is_scc S
[PROOF STEP]
show "is_scc S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_scc S
[PROOF STEP]
proof (cases "S = \<S> e' v")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = \<S> e' v

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with S_reflexive[OF wf']
[PROOF STATE]
proof (chain)
picking this:
?n \<in> \<S> e' ?n
S = \<S> e' v
[PROOF STEP]
have "S \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
?n \<in> \<S> e' ?n
S = \<S> e' v

goal (1 subgoal):
 1. S \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
from wf' True
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
S = \<S> e' v
[PROOF STEP]
have subscc: "is_subscc S"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
S = \<S> e' v

goal (1 subgoal):
 1. is_subscc S
[PROOF STEP]
by (simp add: wf_env_def)
[PROOF STATE]
proof (state)
this:
is_subscc S

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
is_subscc S

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
assume "\<not> is_scc S"
[PROOF STATE]
proof (state)
this:
\<not> is_scc S

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with \<open>S \<noteq> {}\<close> \<open>is_subscc S\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
is_subscc S
\<not> is_scc S
[PROOF STEP]
obtain S' where
              S'_def: "S' \<noteq> S" "S \<subseteq> S'" "is_subscc S'"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
is_subscc S
\<not> is_scc S

goal (1 subgoal):
 1. (\<And>S'. \<lbrakk>S' \<noteq> S; S \<subseteq> S'; is_subscc S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding is_scc_def
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
is_subscc S
\<not> (S \<noteq> {} \<and> is_subscc S \<and> (\<forall>S'. S \<subseteq> S' \<and> is_subscc S' \<longrightarrow> S' = S))

goal (1 subgoal):
 1. (\<And>S'. \<lbrakk>S' \<noteq> S; S \<subseteq> S'; is_subscc S'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S' \<noteq> S
S \<subseteq> S'
is_subscc S'

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S' \<noteq> S
S \<subseteq> S'
is_subscc S'
[PROOF STEP]
obtain x where "x \<in> S' \<and> x \<notin> S"
[PROOF STATE]
proof (prove)
using this:
S' \<noteq> S
S \<subseteq> S'
is_subscc S'

goal (1 subgoal):
 1. (\<And>x. x \<in> S' \<and> x \<notin> S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> S' \<and> x \<notin> S

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with True S'_def wf'
[PROOF STATE]
proof (chain)
picking this:
S = \<S> e' v
S' \<noteq> S
S \<subseteq> S'
is_subscc S'
wf_env e'
x \<in> S' \<and> x \<notin> S
[PROOF STEP]
have xv: "reachable v x \<and> reachable x v"
[PROOF STATE]
proof (prove)
using this:
S = \<S> e' v
S' \<noteq> S
S \<subseteq> S'
is_subscc S'
wf_env e'
x \<in> S' \<and> x \<notin> S

goal (1 subgoal):
 1. reachable v x \<and> reachable x v
[PROOF STEP]
unfolding wf_env_def is_subscc_def
[PROOF STATE]
proof (prove)
using this:
S = \<S> e' v
S' \<noteq> S
S \<subseteq> S'
\<forall>x\<in>S'. \<forall>y\<in>S'. reachable x y
(\<forall>n\<in>visited e'. reachable (root e') n) \<and> distinct (stack e') \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<inter> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. \<forall>x\<in>\<S> e' n. \<forall>y\<in>\<S> e' n. reachable x y) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e'
x \<in> S' \<and> x \<notin> S

goal (1 subgoal):
 1. reachable v x \<and> reachable x v
[PROOF STEP]
by (metis in_mono)
[PROOF STATE]
proof (state)
this:
reachable v x \<and> reachable x v

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
from \<open>\<forall>v w. w \<in> \<S> ?e2 v \<longleftrightarrow> (\<S> ?e2 v = \<S> ?e2 w)\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>va w. (w \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) va) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) va = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w)
[PROOF STEP]
have "v \<in> explored ?e2"
[PROOF STATE]
proof (prove)
using this:
\<forall>va w. (w \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) va) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) va = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w)

goal (1 subgoal):
 1. v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with \<open>\<forall>x \<in> explored ?e2. \<forall>y. reachable x y \<longrightarrow> y \<in> explored ?e2\<close>
                 xv \<open>S = \<S> e' v\<close> \<open>x \<in> S' \<and> x \<notin> S\<close>
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>y. reachable x y \<longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
reachable v x \<and> reachable x v
S = \<S> e' v
x \<in> S' \<and> x \<notin> S
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "x \<in> explored e'"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>y. reachable x y \<longrightarrow> y \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
reachable v x \<and> reachable x v
S = \<S> e' v
x \<in> S' \<and> x \<notin> S
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. x \<in> explored e'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> explored e'

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with wf' xv
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
reachable v x \<and> reachable x v
x \<in> explored e'
[PROOF STEP]
have "v \<in> explored e'"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
reachable v x \<and> reachable x v
x \<in> explored e'

goal (1 subgoal):
 1. v \<in> explored e'
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
v \<in> explored e'

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with notempty
[PROOF STATE]
proof (chain)
picking this:
stack e' = v # stack e
v \<in> explored e'
[PROOF STEP]
have "False"
[PROOF STATE]
proof (prove)
using this:
stack e' = v # stack e
v \<in> explored e'

goal (1 subgoal):
 1. False
[PROOF STEP]
by (auto intro: stack_unexplored[OF wf'])
[PROOF STATE]
proof (state)
this:
False

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> is_scc S \<Longrightarrow> False

goal (2 subgoals):
 1. S = \<S> e' v \<Longrightarrow> is_scc S
 2. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> is_scc S \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> is_scc S \<Longrightarrow> False

goal (1 subgoal):
 1. is_scc S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_scc S

goal (1 subgoal):
 1. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> \<S> e' v

goal (1 subgoal):
 1. S \<noteq> \<S> e' v \<Longrightarrow> is_scc S
[PROOF STEP]
with asm wf'
[PROOF STATE]
proof (chain)
picking this:
S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env e'
S \<noteq> \<S> e' v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<in> sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env e'
S \<noteq> \<S> e' v

goal (1 subgoal):
 1. is_scc S
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
is_scc S

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n
distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}
\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}
\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)
\<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8
\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n
\<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<lbrakk>?x8 \<preceq> ?y8 in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); ?x8 \<noteq> ?y8; ?u8 \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8; reachable_avoiding ?u8 ?y8 (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8)\<rbrakk> \<Longrightarrow> False
Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n
distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}
\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}
\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)
\<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8
\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n
\<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<lbrakk>?x8 \<preceq> ?y8 in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); ?x8 \<noteq> ?y8; ?u8 \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8; reachable_avoiding ?u8 ?y8 (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8)\<rbrakk> \<Longrightarrow> False
Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc

goal (1 subgoal):
 1. wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
unfolding wf_env_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n
distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}
\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)
\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}
\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)
\<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n
\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
?u8 \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<Longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?u8 = successors ?u8
\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n
\<forall>n m. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> m \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}
\<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<lbrakk>?x8 \<preceq> ?y8 in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>); ?x8 \<noteq> ?y8; ?u8 \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8; reachable_avoiding ?u8 ?y8 (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) ?x8)\<rbrakk> \<Longrightarrow> False
Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc

goal (1 subgoal):
 1. (\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). reachable (root (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) n) \<and> distinct (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> distinct (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> (\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> n \<preceq> m in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> (\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> reachable m n) \<and> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<and> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<subseteq> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<and> (\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). \<forall>m. reachable n m \<longrightarrow> m \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> (\<forall>n. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<subseteq> successors n \<inter> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> (\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {}) \<and> (\<forall>n\<in>explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n) \<and> (\<forall>n\<in>visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = successors n) \<and> (\<forall>n m. (m \<in> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n) = (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m)) \<and> (\<forall>n. n \<notin> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = {n}) \<and> (\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). n \<noteq> m \<longrightarrow> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n \<inter> \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) m = {}) \<and> \<Union> {\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n |n. n \<in> set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>))} = visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) - explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<and> (\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<forall>m\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. m \<in> set (cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<longrightarrow> m \<preceq> n in cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) \<and> (\<forall>n m. n \<preceq> m in stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n. \<not> reachable_avoiding u m (unvisited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n))) \<and> (\<forall>n. is_subscc (\<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n)) \<and> Ball (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) is_scc \<and> \<Union> (sccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)) = explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from \<open>wf_env ?e2\<close>
[PROOF STATE]
proof (chain)
picking this:
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
have "v \<in> explored ?e2"
[PROOF STATE]
proof (prove)
using this:
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (1 subgoal):
 1. v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "vsuccs ?e2 v = successors v"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v
[PROOF STEP]
by (simp add: post_dfss_def)
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 1 3
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
post_dfss v e1 e'
[PROOF STEP]
have "\<forall>w \<in> visited e. vsuccs ?e2 w = vsuccs e w"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e
post_dfss v e1 e'

goal (1 subgoal):
 1. \<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w
[PROOF STEP]
by (auto simp: pre_dfs_def post_dfss_def e1_def)
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from stack2 1
[PROOF STATE]
proof (chain)
picking this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
pre_dfs v e
[PROOF STEP]
have "\<forall>n \<in> set (stack ?e2). reachable n v"
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
pre_dfs v e

goal (1 subgoal):
 1. \<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v
[PROOF STEP]
by (simp add: pre_dfs_def)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from stack2
[PROOF STATE]
proof (chain)
picking this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
[PROOF STEP]
have "\<exists>ns. stack e = ns @ (stack ?e2)"
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e

goal (1 subgoal):
 1. \<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "\<forall>n \<in> set (stack ?e2). \<S> ?e2 n = \<S> e n"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. \<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n
[PROOF STEP]
by (auto simp: post_dfss_def e1_def)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from cst'
[PROOF STATE]
proof (chain)
picking this:
cstack e' = v # cstack e
[PROOF STEP]
have "cstack ?e2 = cstack e"
[PROOF STATE]
proof (prove)
using this:
cstack e' = v # cstack e

goal (1 subgoal):
 1. cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e

goal (2 subgoals):
 1. v = hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
 2. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n
cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n
cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
unfolding post_dfs_def
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n
cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e

goal (1 subgoal):
 1. wf_env (dfs v e) \<and> v \<in> visited (dfs v e) \<and> sub_env e (dfs v e) \<and> vsuccs (dfs v e) v = successors v \<and> (\<forall>w\<in>visited e. vsuccs (dfs v e) w = vsuccs e w) \<and> (\<forall>n\<in>set (stack (dfs v e)). reachable n v) \<and> (\<exists>ns. stack e = ns @ stack (dfs v e)) \<and> (v \<in> explored (dfs v e) \<and> stack (dfs v e) = stack e \<and> (\<forall>n\<in>set (stack (dfs v e)). \<S> (dfs v e) n = \<S> e n) \<or> stack (dfs v e) \<noteq> [] \<and> v \<in> \<S> (dfs v e) (hd (stack (dfs v e))) \<and> (\<forall>n\<in>set (tl (stack (dfs v e))). \<S> (dfs v e) n = \<S> e n)) \<and> cstack (dfs v e) = cstack e
[PROOF STEP]
using e2
[PROOF STATE]
proof (prove)
using this:
stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = stack e
v \<in> visited (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
sub_env e (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
wf_env (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
v \<in> explored (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) v = successors v
\<forall>w\<in>visited e. vsuccs (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) w = vsuccs e w
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). reachable n v
\<exists>ns. stack e = ns @ stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)
\<forall>n\<in>set (stack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>)). \<S> (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) n = \<S> e n
cstack (e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>) = cstack e
dfs v e = e'\<lparr>sccs := sccs e' \<union> {\<S> e' v}, explored := explored e' \<union> \<S> e' v, stack := tl (stack e'), cstack := tl (cstack e')\<rparr>

goal (1 subgoal):
 1. wf_env (dfs v e) \<and> v \<in> visited (dfs v e) \<and> sub_env e (dfs v e) \<and> vsuccs (dfs v e) v = successors v \<and> (\<forall>w\<in>visited e. vsuccs (dfs v e) w = vsuccs e w) \<and> (\<forall>n\<in>set (stack (dfs v e)). reachable n v) \<and> (\<exists>ns. stack e = ns @ stack (dfs v e)) \<and> (v \<in> explored (dfs v e) \<and> stack (dfs v e) = stack e \<and> (\<forall>n\<in>set (stack (dfs v e)). \<S> (dfs v e) n = \<S> e n) \<or> stack (dfs v e) \<noteq> [] \<and> v \<in> \<S> (dfs v e) (hd (stack (dfs v e))) \<and> (\<forall>n\<in>set (tl (stack (dfs v e))). \<S> (dfs v e) n = \<S> e n)) \<and> cstack (dfs v e) = cstack e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
post_dfs v e (dfs v e)

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
v \<noteq> hd (stack e')

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
dfs_dfss_dom (Inl (v, e))
v \<noteq> hd (stack e')
[PROOF STEP]
have e': "dfs v e = e''"
[PROOF STATE]
proof (prove)
using this:
dfs_dfss_dom (Inl (v, e))
v \<noteq> hd (stack e')

goal (1 subgoal):
 1. dfs v e = e''
[PROOF STEP]
by (simp add: dfs.psimps e''_def e'_def e1_def)
[PROOF STATE]
proof (state)
this:
dfs v e = e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dfs v e = e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have "wf_env e''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
from wf'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
[PROOF STEP]
have "\<forall>n \<in> visited e''. reachable (root e'') n"
           "distinct (stack e'')"
           "distinct (cstack e'')"
           "\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n"
           "explored e'' \<subseteq> visited e''"
           "\<forall>n \<in> explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''"
           "\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''"
           "\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}"
           "\<forall>n \<in> explored e''. vsuccs e'' n = successors n"
           "\<forall>n m. m \<in> \<S> e'' n \<longleftrightarrow> (\<S> e'' n = \<S> e'' m)"
           "\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}"
           "\<forall>n \<in> set (stack e''). \<forall>m \<in> set (stack e'').
               n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}"
           "\<Union> {\<S> e'' n | n. n \<in> set (stack e'')} = visited e'' - explored e''"
           "\<forall>n. is_subscc (\<S> e'' n)"
           "\<forall>S \<in> sccs e''. is_scc S"
           "\<Union> (sccs e'') = explored e''"
[PROOF STATE]
proof (prove)
using this:
wf_env e'

goal (1 subgoal):
 1. (((\<forall>n\<in>visited e''. reachable (root e'') n &&& distinct (stack e'')) &&& distinct (cstack e'') &&& \<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n) &&& (explored e'' \<subseteq> visited e'' &&& \<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e'') &&& \<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e'' &&& \<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}) &&& ((\<forall>n\<in>explored e''. vsuccs e'' n = successors n &&& \<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)) &&& \<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n} &&& \<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}) &&& (\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e'' &&& \<forall>n. is_subscc (\<S> e'' n)) &&& Ball (sccs e'') is_scc &&& \<Union> (sccs e'') = explored e''
[PROOF STEP]
by (auto simp: e''_def wf_env_def distinct_tl)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited e''. reachable (root e'') n
distinct (stack e'')
distinct (cstack e'')
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n
explored e'' \<subseteq> visited e''
\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''
\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''
\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}
\<forall>n\<in>explored e''. vsuccs e'' n = successors n
\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)
\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}
\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}
\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e''
\<forall>n. is_subscc (\<S> e'' n)
Ball (sccs e'') is_scc
\<Union> (sccs e'') = explored e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited e''. reachable (root e'') n
distinct (stack e'')
distinct (cstack e'')
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n
explored e'' \<subseteq> visited e''
\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''
\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''
\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}
\<forall>n\<in>explored e''. vsuccs e'' n = successors n
\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)
\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}
\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}
\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e''
\<forall>n. is_subscc (\<S> e'' n)
Ball (sccs e'') is_scc
\<Union> (sccs e'') = explored e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
have "\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''
[PROOF STEP]
proof (clarsimp simp add: e''_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
fix n m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
assume nm: "n \<preceq> m in stack e'"
[PROOF STATE]
proof (state)
this:
n \<preceq> m in stack e'

goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
n \<preceq> m in stack e'
[PROOF STEP]
have "n \<preceq> m in cstack e'"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
n \<preceq> m in stack e'

goal (1 subgoal):
 1. n \<preceq> m in cstack e'
[PROOF STEP]
unfolding post_dfss_def wf_env_def
[PROOF STATE]
proof (prove)
using this:
((\<forall>n\<in>visited e'. reachable (root e') n) \<and> distinct (stack e') \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<inter> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e') \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e1 - {v}. vsuccs e' w = vsuccs e1 w) \<and> sub_env e1 e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<union> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. stack e1 = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e1 n) \<and> (hd (stack e') = v \<longrightarrow> (\<forall>n\<in>set (tl (stack e')). \<not> reachable v n)) \<and> cstack e' = cstack e1
n \<preceq> m in stack e'

goal (1 subgoal):
 1. n \<preceq> m in cstack e'
[PROOF STEP]
by meson
[PROOF STATE]
proof (state)
this:
n \<preceq> m in cstack e'

goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n \<preceq> m in cstack e'

goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
have "n \<noteq> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> v
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n = v \<Longrightarrow> False
[PROOF STEP]
assume "n = v"
[PROOF STATE]
proof (state)
this:
n = v

goal (1 subgoal):
 1. n = v \<Longrightarrow> False
[PROOF STEP]
with nm
[PROOF STATE]
proof (chain)
picking this:
n \<preceq> m in stack e'
n = v
[PROOF STEP]
have "n \<in> set (stack e')"
[PROOF STATE]
proof (prove)
using this:
n \<preceq> m in stack e'
n = v

goal (1 subgoal):
 1. n \<in> set (stack e')
[PROOF STEP]
by (simp add: precedes_mem)
[PROOF STATE]
proof (state)
this:
n \<in> set (stack e')

goal (1 subgoal):
 1. n = v \<Longrightarrow> False
[PROOF STEP]
with 3 \<open>n = v\<close>
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
n = v
n \<in> set (stack e')
[PROOF STEP]
have "v = hd (stack e')"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
n = v
n \<in> set (stack e')

goal (1 subgoal):
 1. v = hd (stack e')
[PROOF STEP]
unfolding post_dfss_def wf_env_def
[PROOF STATE]
proof (prove)
using this:
((\<forall>n\<in>visited e'. reachable (root e') n) \<and> distinct (stack e') \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<inter> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e') \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e1 - {v}. vsuccs e' w = vsuccs e1 w) \<and> sub_env e1 e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<union> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. stack e1 = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e1 n) \<and> (hd (stack e') = v \<longrightarrow> (\<forall>n\<in>set (tl (stack e')). \<not> reachable v n)) \<and> cstack e' = cstack e1
n = v
n \<in> set (stack e')

goal (1 subgoal):
 1. v = hd (stack e')
[PROOF STEP]
by (metis (no_types, opaque_lifting) IntI equals0D list.set_sel(1))
[PROOF STATE]
proof (state)
this:
v = hd (stack e')

goal (1 subgoal):
 1. n = v \<Longrightarrow> False
[PROOF STEP]
with \<open>v \<noteq> hd (stack e')\<close>
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> hd (stack e')
v = hd (stack e')
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
v \<noteq> hd (stack e')
v = hd (stack e')

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
n \<noteq> v

goal (1 subgoal):
 1. \<And>n m. n \<preceq> m in stack e' \<Longrightarrow> n \<preceq> m in tl (cstack e')
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n \<preceq> m in cstack e'
n \<noteq> v
[PROOF STEP]
show "n \<preceq> m in tl (cstack e')"
[PROOF STATE]
proof (prove)
using this:
n \<preceq> m in cstack e'
n \<noteq> v

goal (1 subgoal):
 1. n \<preceq> m in tl (cstack e')
[PROOF STEP]
by (simp add: cst' precedes_in_tail)
[PROOF STATE]
proof (state)
this:
n \<preceq> m in tl (cstack e')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "set (cstack e'') \<subseteq> visited e''"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. set (cstack e'') \<subseteq> visited e''
[PROOF STEP]
by (simp add: post_dfss_def wf_env_def e''_def e1_def subset_eq)
[PROOF STATE]
proof (state)
this:
set (cstack e'') \<subseteq> visited e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set (cstack e'') \<subseteq> visited e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "\<forall>n \<in> visited e'' - set (cstack e''). vsuccs e'' n = successors n"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. \<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n
[PROOF STEP]
apply (simp add: post_dfss_def wf_env_def e''_def e1_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (visited e') (reachable (root e')) \<and> distinct (stack e') \<and> distinct (cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> n \<preceq> m in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<longrightarrow> reachable m n) \<and> explored e' \<subseteq> visited e' \<and> set (cstack e') \<subseteq> visited e' \<and> (\<forall>n\<in>explored e'. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e') \<and> (\<forall>n. vsuccs e' n \<subseteq> successors n \<and> vsuccs e' n \<subseteq> visited e') \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> vsuccs e' n = {}) \<and> (\<forall>n\<in>explored e'. vsuccs e' n = successors n) \<and> (\<forall>n\<in>visited e' - set (cstack e'). vsuccs e' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e' n) = (\<S> e' n = \<S> e' m)) \<and> (\<forall>n. n \<notin> visited e' \<longrightarrow> \<S> e' n = {n}) \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>set (stack e'). n \<noteq> m \<longrightarrow> \<S> e' n \<inter> \<S> e' m = {}) \<and> \<Union> {\<S> e' n |n. n \<in> set (stack e')} = visited e' - explored e' \<and> (\<forall>n\<in>set (stack e'). \<forall>m\<in>\<S> e' n. m \<in> set (cstack e') \<longrightarrow> m \<preceq> n in cstack e') \<and> (\<forall>n m. n \<preceq> m in stack e' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e' n. \<not> reachable_avoiding u m (unvisited e' n))) \<and> (\<forall>n. is_subscc (\<S> e' n)) \<and> Ball (sccs e') is_scc \<and> \<Union> (sccs e') = explored e' \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e - {v}. vsuccs e' w = vsuccs e w) \<and> sub_env (e\<lparr>visited := insert v (visited e), stack := v # stack e, cstack := v # cstack e\<rparr>) e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<or> w \<in> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. v # stack e = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e n) \<and> (hd (stack e') = v \<longrightarrow> (\<forall>n\<in>set (tl (stack e')). \<not> reachable v n)) \<and> cstack e' = v # cstack e \<Longrightarrow> \<forall>n\<in>visited e' - set (cstack e). vsuccs e' n = successors n
[PROOF STEP]
by (metis (no_types, opaque_lifting) DiffE DiffI set_ConsD)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
have "\<forall>n \<in> set (stack e''). \<forall>m \<in> \<S> e'' n.
               m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''
[PROOF STEP]
proof (clarsimp simp: e''_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (stack e'); m \<in> \<S> e' n; m \<in> set (tl (cstack e'))\<rbrakk> \<Longrightarrow> m \<preceq> n in tl (cstack e')
[PROOF STEP]
fix m n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (stack e'); m \<in> \<S> e' n; m \<in> set (tl (cstack e'))\<rbrakk> \<Longrightarrow> m \<preceq> n in tl (cstack e')
[PROOF STEP]
assume asm: "n \<in> set (stack e')" "m \<in> \<S> e' n"
                    "m \<in> set (tl (cstack e'))"
[PROOF STATE]
proof (state)
this:
n \<in> set (stack e')
m \<in> \<S> e' n
m \<in> set (tl (cstack e'))

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (stack e'); m \<in> \<S> e' n; m \<in> set (tl (cstack e'))\<rbrakk> \<Longrightarrow> m \<preceq> n in tl (cstack e')
[PROOF STEP]
with wf' cst'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
cstack e' = v # cstack e
n \<in> set (stack e')
m \<in> \<S> e' n
m \<in> set (tl (cstack e'))
[PROOF STEP]
have "m \<noteq> v" "m \<preceq> n in cstack e'"
[PROOF STATE]
proof (prove)
using this:
wf_env e'
cstack e' = v # cstack e
n \<in> set (stack e')
m \<in> \<S> e' n
m \<in> set (tl (cstack e'))

goal (1 subgoal):
 1. m \<noteq> v &&& m \<preceq> n in cstack e'
[PROOF STEP]
by (auto simp: wf_env_def)
[PROOF STATE]
proof (state)
this:
m \<noteq> v
m \<preceq> n in cstack e'

goal (1 subgoal):
 1. \<And>n m. \<lbrakk>n \<in> set (stack e'); m \<in> \<S> e' n; m \<in> set (tl (cstack e'))\<rbrakk> \<Longrightarrow> m \<preceq> n in tl (cstack e')
[PROOF STEP]
with cst'
[PROOF STATE]
proof (chain)
picking this:
cstack e' = v # cstack e
m \<noteq> v
m \<preceq> n in cstack e'
[PROOF STEP]
show "m \<preceq> n in tl (cstack e')"
[PROOF STATE]
proof (prove)
using this:
cstack e' = v # cstack e
m \<noteq> v
m \<preceq> n in cstack e'

goal (1 subgoal):
 1. m \<preceq> n in tl (cstack e')
[PROOF STEP]
by (simp add: precedes_in_tail)
[PROOF STATE]
proof (state)
this:
m \<preceq> n in tl (cstack e')

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
from wf'
[PROOF STATE]
proof (chain)
picking this:
wf_env e'
[PROOF STEP]
have "(\<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow>
                (\<forall>u \<in> \<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x)))"
[PROOF STATE]
proof (prove)
using this:
wf_env e'

goal (1 subgoal):
 1. \<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow> (\<forall>u\<in>\<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x))
[PROOF STEP]
by (force simp: e''_def wf_env_def unvisited_def)
[PROOF STATE]
proof (state)
this:
\<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow> (\<forall>u\<in>\<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x))

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<in>visited e''. reachable (root e'') n
distinct (stack e'')
distinct (cstack e'')
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n
explored e'' \<subseteq> visited e''
\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''
\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''
\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}
\<forall>n\<in>explored e''. vsuccs e'' n = successors n
\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)
\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}
\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}
\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e''
\<forall>n. is_subscc (\<S> e'' n)
Ball (sccs e'') is_scc
\<Union> (sccs e'') = explored e''
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''
set (cstack e'') \<subseteq> visited e''
\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n
\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''
\<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow> (\<forall>u\<in>\<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>visited e''. reachable (root e'') n
distinct (stack e'')
distinct (cstack e'')
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n
explored e'' \<subseteq> visited e''
\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''
\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''
\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}
\<forall>n\<in>explored e''. vsuccs e'' n = successors n
\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)
\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}
\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}
\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e''
\<forall>n. is_subscc (\<S> e'' n)
Ball (sccs e'') is_scc
\<Union> (sccs e'') = explored e''
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''
set (cstack e'') \<subseteq> visited e''
\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n
\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''
\<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow> (\<forall>u\<in>\<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x))

goal (1 subgoal):
 1. wf_env e''
[PROOF STEP]
unfolding wf_env_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<in>visited e''. reachable (root e'') n
distinct (stack e'')
distinct (cstack e'')
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n
explored e'' \<subseteq> visited e''
\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e''
\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e''
\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}
\<forall>n\<in>explored e''. vsuccs e'' n = successors n
\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)
\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}
\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}
\<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e''
\<forall>n. is_subscc (\<S> e'' n)
Ball (sccs e'') is_scc
\<Union> (sccs e'') = explored e''
\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e''
set (cstack e'') \<subseteq> visited e''
\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n
\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e''
\<forall>x y. x \<preceq> y in stack e'' \<and> x \<noteq> y \<longrightarrow> (\<forall>u\<in>\<S> e'' x. \<not> reachable_avoiding u y (unvisited e'' x))

goal (1 subgoal):
 1. (\<forall>n\<in>visited e''. reachable (root e'') n) \<and> distinct (stack e'') \<and> distinct (cstack e'') \<and> (\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> n \<preceq> m in cstack e'') \<and> (\<forall>n m. n \<preceq> m in stack e'' \<longrightarrow> reachable m n) \<and> explored e'' \<subseteq> visited e'' \<and> set (cstack e'') \<subseteq> visited e'' \<and> (\<forall>n\<in>explored e''. \<forall>m. reachable n m \<longrightarrow> m \<in> explored e'') \<and> (\<forall>n. vsuccs e'' n \<subseteq> successors n \<inter> visited e'') \<and> (\<forall>n. n \<notin> visited e'' \<longrightarrow> vsuccs e'' n = {}) \<and> (\<forall>n\<in>explored e''. vsuccs e'' n = successors n) \<and> (\<forall>n\<in>visited e'' - set (cstack e''). vsuccs e'' n = successors n) \<and> (\<forall>n m. (m \<in> \<S> e'' n) = (\<S> e'' n = \<S> e'' m)) \<and> (\<forall>n. n \<notin> visited e'' \<longrightarrow> \<S> e'' n = {n}) \<and> (\<forall>n\<in>set (stack e''). \<forall>m\<in>set (stack e''). n \<noteq> m \<longrightarrow> \<S> e'' n \<inter> \<S> e'' m = {}) \<and> \<Union> {\<S> e'' n |n. n \<in> set (stack e'')} = visited e'' - explored e'' \<and> (\<forall>n\<in>set (stack e''). \<forall>m\<in>\<S> e'' n. m \<in> set (cstack e'') \<longrightarrow> m \<preceq> n in cstack e'') \<and> (\<forall>n m. n \<preceq> m in stack e'' \<and> n \<noteq> m \<longrightarrow> (\<forall>u\<in>\<S> e'' n. \<not> reachable_avoiding u m (unvisited e'' n))) \<and> (\<forall>n. is_subscc (\<S> e'' n)) \<and> Ball (sccs e'') is_scc \<and> \<Union> (sccs e'') = explored e''
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
wf_env e''

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

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
wf_env e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "v \<in> visited e''"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. v \<in> visited e''
[PROOF STEP]
by (auto simp: post_dfss_def sub_env_def e''_def e1_def)
[PROOF STATE]
proof (state)
this:
v \<in> visited e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<in> visited e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
have subenv: "sub_env e e''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_env e e''
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sub_env e e''
[PROOF STEP]
have "sub_env e e1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_env e e1
[PROOF STEP]
by (auto simp: sub_env_def e1_def)
[PROOF STATE]
proof (state)
this:
sub_env e e1

goal (1 subgoal):
 1. sub_env e e''
[PROOF STEP]
with 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
sub_env e e1
[PROOF STEP]
have "sub_env e e'"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
sub_env e e1

goal (1 subgoal):
 1. sub_env e e'
[PROOF STEP]
by (auto simp: post_dfss_def elim: sub_env_trans)
[PROOF STATE]
proof (state)
this:
sub_env e e'

goal (1 subgoal):
 1. sub_env e e''
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sub_env e e'

goal (1 subgoal):
 1. sub_env e e''
[PROOF STEP]
by (auto simp add: sub_env_def e''_def)
[PROOF STATE]
proof (state)
this:
sub_env e e''

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

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sub_env e e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "vsuccs e'' v = successors v"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. vsuccs e'' v = successors v
[PROOF STEP]
by (simp add: post_dfss_def e''_def)
[PROOF STATE]
proof (state)
this:
vsuccs e'' v = successors v

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vsuccs e'' v = successors v

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 1 3
[PROOF STATE]
proof (chain)
picking this:
pre_dfs v e
post_dfss v e1 e'
[PROOF STEP]
have "\<forall>w \<in> visited e. vsuccs e'' w = vsuccs e w"
[PROOF STATE]
proof (prove)
using this:
pre_dfs v e
post_dfss v e1 e'

goal (1 subgoal):
 1. \<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w
[PROOF STEP]
by (auto simp: pre_dfs_def post_dfss_def e1_def e''_def)
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "\<forall>n \<in> set (stack e''). reachable n v"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. \<forall>n\<in>set (stack e''). reachable n v
[PROOF STEP]
by (auto simp: e''_def post_dfss_def)
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack e''). reachable n v

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>n\<in>set (stack e''). reachable n v

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3 \<open>v \<noteq> hd (stack e')\<close>
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
v \<noteq> hd (stack e')
[PROOF STEP]
have "\<exists>ns. stack e = ns @ (stack e'')"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'
v \<noteq> hd (stack e')

goal (1 subgoal):
 1. \<exists>ns. stack e = ns @ stack e''
[PROOF STEP]
apply (simp add: post_dfss_def e''_def e1_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_env e' \<and> vsuccs e' v = successors v \<and> (\<forall>w\<in>visited e - {v}. vsuccs e' w = vsuccs e w) \<and> sub_env (e\<lparr>visited := insert v (visited e), stack := v # stack e, cstack := v # cstack e\<rparr>) e' \<and> (\<forall>w\<in>successors v. w \<in> explored e' \<or> w \<in> \<S> e' (hd (stack e'))) \<and> (\<forall>n\<in>set (stack e'). reachable n v) \<and> stack e' \<noteq> [] \<and> (\<exists>ns. v # stack e = ns @ stack e') \<and> v \<in> \<S> e' (hd (stack e')) \<and> (\<forall>n\<in>set (tl (stack e')). \<S> e' n = \<S> e n) \<and> cstack e' = v # cstack e; v \<noteq> hd (stack e')\<rbrakk> \<Longrightarrow> \<exists>ns. stack e = ns @ stack e'
[PROOF STEP]
by (metis append_Nil list.sel(1) list.sel(3) tl_append2)
[PROOF STATE]
proof (state)
this:
\<exists>ns. stack e = ns @ stack e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>ns. stack e = ns @ stack e''

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from 3
[PROOF STATE]
proof (chain)
picking this:
post_dfss v e1 e'
[PROOF STEP]
have "stack e'' \<noteq> []" "v \<in> \<S> e'' (hd (stack e''))"
         "\<forall>n \<in> set (tl (stack e'')). \<S> e'' n = \<S> e n"
[PROOF STATE]
proof (prove)
using this:
post_dfss v e1 e'

goal (1 subgoal):
 1. stack e'' \<noteq> [] &&& v \<in> \<S> e'' (hd (stack e'')) &&& \<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n
[PROOF STEP]
by (auto simp: post_dfss_def e1_def e''_def)
[PROOF STATE]
proof (state)
this:
stack e'' \<noteq> []
v \<in> \<S> e'' (hd (stack e''))
\<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
stack e'' \<noteq> []
v \<in> \<S> e'' (hd (stack e''))
\<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
from cst'
[PROOF STATE]
proof (chain)
picking this:
cstack e' = v # cstack e
[PROOF STEP]
have "cstack e'' = cstack e"
[PROOF STATE]
proof (prove)
using this:
cstack e' = v # cstack e

goal (1 subgoal):
 1. cstack e'' = cstack e
[PROOF STEP]
by (simp add: e''_def)
[PROOF STATE]
proof (state)
this:
cstack e'' = cstack e

goal (1 subgoal):
 1. v \<noteq> hd (stack e') \<Longrightarrow> post_dfs v e (dfs v e)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dfs v e = e''
wf_env e''
v \<in> visited e''
sub_env e e''
vsuccs e'' v = successors v
\<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w
\<forall>n\<in>set (stack e''). reachable n v
\<exists>ns. stack e = ns @ stack e''
stack e'' \<noteq> []
v \<in> \<S> e'' (hd (stack e''))
\<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n
cstack e'' = cstack e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dfs v e = e''
wf_env e''
v \<in> visited e''
sub_env e e''
vsuccs e'' v = successors v
\<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w
\<forall>n\<in>set (stack e''). reachable n v
\<exists>ns. stack e = ns @ stack e''
stack e'' \<noteq> []
v \<in> \<S> e'' (hd (stack e''))
\<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n
cstack e'' = cstack e

goal (1 subgoal):
 1. post_dfs v e (dfs v e)
[PROOF STEP]
unfolding post_dfs_def
[PROOF STATE]
proof (prove)
using this:
dfs v e = e''
wf_env e''
v \<in> visited e''
sub_env e e''
vsuccs e'' v = successors v
\<forall>w\<in>visited e. vsuccs e'' w = vsuccs e w
\<forall>n\<in>set (stack e''). reachable n v
\<exists>ns. stack e = ns @ stack e''
stack e'' \<noteq> []
v \<in> \<S> e'' (hd (stack e''))
\<forall>n\<in>set (tl (stack e'')). \<S> e'' n = \<S> e n
cstack e'' = cstack e

goal (1 subgoal):
 1. wf_env (dfs v e) \<and> v \<in> visited (dfs v e) \<and> sub_env e (dfs v e) \<and> vsuccs (dfs v e) v = successors v \<and> (\<forall>w\<in>visited e. vsuccs (dfs v e) w = vsuccs e w) \<and> (\<forall>n\<in>set (stack (dfs v e)). reachable n v) \<and> (\<exists>ns. stack e = ns @ stack (dfs v e)) \<and> (v \<in> explored (dfs v e) \<and> stack (dfs v e) = stack e \<and> (\<forall>n\<in>set (stack (dfs v e)). \<S> (dfs v e) n = \<S> e n) \<or> stack (dfs v e) \<noteq> [] \<and> v \<in> \<S> (dfs v e) (hd (stack (dfs v e))) \<and> (\<forall>n\<in>set (tl (stack (dfs v e))). \<S> (dfs v e) n = \<S> e n)) \<and> cstack (dfs v e) = cstack e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
post_dfs v e (dfs v e)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
post_dfs v e (dfs v e)

goal:
No subgoals!
[PROOF STEP]
qed