Theory TopoS_Interface_impl
theory TopoS_Interface_impl
imports "Lib/FiniteGraph" "Lib/FiniteListGraph" TopoS_Interface TopoS_Helper
begin
section‹Executable Implementation with Lists›
text ‹Correspondence List Implementation and set Specification›
subsection‹Abstraction from list implementation to set specification›
text‹Nomenclature: ‹_spec› is the specification, ‹_impl› the corresponding implementation.›
text‹‹_spec› and ‹_impl› only need to comply for @{const wf_graph}s.
We will always require the stricter @{const wf_list_graph}, which implies @{const wf_graph}.
›
lemma "wf_list_graph G ⟹ wf_graph (list_graph_to_graph G)"
by %invisible (metis wf_list_graph_def wf_list_graph_iff_wf_graph)
locale TopoS_List_Impl =
fixes default_node_properties :: "'a" (‹⊥›)
and sinvar_spec::"('v::vertex) graph ⇒ ('v::vertex ⇒ 'a) ⇒ bool"
and sinvar_impl::"('v::vertex) list_graph ⇒ ('v::vertex ⇒ 'a) ⇒ bool"
and receiver_violation :: "bool"
and offending_flows_impl::"('v::vertex) list_graph ⇒ ('v ⇒ 'a) ⇒ ('v × 'v) list list"
and node_props_impl::"('v::vertex, 'a) TopoS_Params ⇒ ('v ⇒ 'a)"
and eval_impl::"('v::vertex) list_graph ⇒ ('v, 'a) TopoS_Params ⇒ bool"
assumes
spec: "SecurityInvariant sinvar_spec default_node_properties receiver_violation"
and
sinvar_spec_impl: "wf_list_graph G ⟹
(sinvar_spec (list_graph_to_graph G) nP) = (sinvar_impl G nP)"
and
offending_flows_spec_impl: "wf_list_graph G ⟹
(SecurityInvariant_withOffendingFlows.set_offending_flows sinvar_spec (list_graph_to_graph G) nP) =
set`set (offending_flows_impl G nP)"
and
node_props_spec_impl:
"SecurityInvariant.node_props_formaldef default_node_properties P = node_props_impl P"
and
eval_spec_impl:
"(distinct (nodesL G) ∧ distinct (edgesL G) ∧
SecurityInvariant.eval sinvar_spec default_node_properties (list_graph_to_graph G) P ) =
(eval_impl G P)"
subsection ‹Security Invariants Packed›
text ‹We pack all necessary functions and properties of a security invariant in a struct-like data structure.›