Theory DFS_Framework.Reachable_Nodes
section ‹Set of Reachable Nodes›
theory Reachable_Nodes
imports "../DFS_Framework"
CAVA_Automata.Digraph_Impl
"../Misc/Impl_Rev_Array_Stack"
begin
text ‹
This theory provides a re-usable algorithm to compute the set of reachable
nodes in a graph.
›
subsection ‹Preliminaries›
lemma gen_obtain_finite_set:
assumes F: "finite S"
assumes E: "(e,{})∈⟨R⟩Rs"
assumes I: "(i,insert)∈R→⟨R⟩Rs→⟨R⟩Rs"
assumes EE: "⋀x. x∈S ⟹ ∃xi. (xi,x)∈R"
shows "∃Si. (Si,S)∈⟨R⟩Rs"
proof -
define S' where "S' = S"
have "S⊆S'" by (simp add: S'_def)
from F this show "(∃Si. (Si,S)∈⟨R⟩Rs)"
proof (induction)
case empty thus ?case
using E by (blast)
next
case (insert x S)
then obtain xi Si where 1: "(Si,S)∈⟨R⟩Rs" and 2: "(xi,x)∈R"
using EE unfolding S'_def by blast
from I[THEN fun_relD, OF 2, THEN fun_relD, OF 1] show ?case ..
qed
qed
lemma obtain_finite_ahs: "finite S ⟹ ∃x. (x,S)∈⟨Id⟩dflt_ahs_rel"
apply (erule gen_obtain_finite_set)
apply autoref
apply autoref
by blast
subsection ‹Framework Instantiation›
definition "unit_parametrization ≡ dflt_parametrization (λ_. ()) (RETURN ())"
lemmas unit_parametrization_simp[simp, DFS_code_unfold] =
dflt_parametrization_simp[mk_record_simp, OF, OF unit_parametrization_def]