Theory LabeledGraphSemantics
section ‹Semantics in labeled graphs›
theory LabeledGraphSemantics
imports LabeledGraphs
begin
text ‹GetRel describes the main way we interpret graphs: as describing a set of binary relations.›
definition getRel where
"getRel l G = {(x,y). (l,x,y) ∈ edges G}"
lemma getRel_dom:
assumes "graph G"
shows "(a,b) ∈ getRel l G ⟹ a ∈ vertices G"
"(a,b) ∈ getRel l G ⟹ b ∈ vertices G"
using assms unfolding getRel_def by auto
lemma getRel_subgraph[simp]:
assumes "(y, z) ∈ getRel l G" "subgraph G G'"
shows "(y,z) ∈ getRel l G'" using assms by (auto simp:getRel_def subgraph_def graph_union_iff)
lemma getRel_homR:
assumes "(y, z) ∈ getRel l G" "(y,u) ∈ f" "(z,v) ∈ f"
shows "(u, v) ∈ getRel l (map_graph f G)"
using assms by (auto simp:getRel_def on_triple_def)
lemma getRel_hom[intro]:
assumes "(y, z) ∈ getRel l G" "y ∈ vertices G" "z ∈ vertices G"
shows "(f y, f z) ∈ getRel l (map_graph_fn G f)"
using assms by (auto intro!:getRel_homR)
lemma getRel_hom_map[simp]:
assumes "graph G"
shows "getRel l (map_graph_fn G f) = map_prod f f ` (getRel l G)"
proof
{ fix x y
assume a:"(x, y) ∈ getRel l G"
hence "x ∈ vertices G" "y∈ vertices G" using assms unfolding getRel_def by auto
hence "(f x, f y) ∈ getRel l (map_graph_fn G f)" using a by auto
}
then show "map_prod f f ` getRel l G ⊆ getRel l (map_graph_fn G f)" by auto
qed (cases G,auto simp:getRel_def)
text ‹The thing called term in the paper is called @{term alligorical_term} here.
This naming is chosen because an allegory has precisely these operations, plus identity. ›