Theory CZH_DG_GRPH

(* Copyright 2021 (C) Mihails Milehins *)

sectionGRPH› as a digraph›
theory CZH_DG_GRPH
  imports 
    CZH_DG_DGHM
    CZH_DG_Small_Digraph
begin



subsection‹Background›


text‹
Conventionally, GRPH› defined as a category of digraphs and digraph 
homomorphisms (e.g., see Chapter II-7 in cite"mac_lane_categories_2010").
However, there is little that can prevent one from exposing GRPH›
as a digraph and provide additional structure gradually later. 
Thus, in this section, α›-GRPH› is 
defined as a digraph of digraphs and digraph homomorphisms in Vα.
›

named_theorems GRPH_cs_simps
named_theorems GRPH_cs_intros



subsection‹Definition and elementary properties›

definition dg_GRPH :: "V  V"
  where "dg_GRPH α =
    [
      set {. digraph α },
      all_dghms α,
      (λ𝔉all_dghms α. 𝔉HomDom),
      (λ𝔉all_dghms α. 𝔉HomCod)
    ]"


text‹Components.›

lemma dg_GRPH_components:
  shows "dg_GRPH αObj = set {. digraph α }"
    and "dg_GRPH αArr = all_dghms α"
    and "dg_GRPH αDom = (λ𝔉all_dghms α. 𝔉HomDom)"
    and "dg_GRPH αCod = (λ𝔉all_dghms α. 𝔉HomCod)"
  unfolding dg_GRPH_def dg_field_simps by (simp_all add: nat_omega_simps)



subsection‹Object›

lemma dg_GRPH_ObjI:
  assumes "digraph α 𝔄"
  shows "𝔄  dg_GRPH αObj"
  using assms unfolding dg_GRPH_components by auto

lemma dg_GRPH_ObjD:
  assumes "𝔄  dg_GRPH αObj"
  shows "digraph α 𝔄"
  using assms unfolding dg_GRPH_components by auto

lemma dg_GRPH_ObjE:
  assumes "𝔄  dg_GRPH αObj"
  obtains "digraph α 𝔄"
  using assms unfolding dg_GRPH_components by auto

lemma dg_GRPH_Obj_iff[GRPH_cs_simps]: 
  "𝔄  dg_GRPH αObj  digraph α 𝔄"
  unfolding dg_GRPH_components by auto



subsection‹Domain›

mk_VLambda dg_GRPH_components(3)
  |vsv dg_GRPH_Dom_vsv[GRPH_cs_intros]|
  |vdomain dg_GRPH_Dom_vdomain[GRPH_cs_simps]|
  |app dg_GRPH_Dom_app[GRPH_cs_simps]|

lemma dg_GRPH_Dom_vrange: " (dg_GRPH αDom)  dg_GRPH αObj"
  unfolding dg_GRPH_components by (rule vrange_VLambda_vsubset) auto



subsection‹Codomain›

mk_VLambda dg_GRPH_components(4)
  |vsv dg_GRPH_Cod_vsv[GRPH_cs_intros]|
  |vdomain dg_GRPH_Cod_vdomain[GRPH_cs_simps]|
  |app dg_GRPH_Cod_app[GRPH_cs_simps]|

lemma dg_GRPH_Cod_vrange: " (dg_GRPH αCod)  dg_GRPH αObj"
  unfolding dg_GRPH_components by (rule vrange_VLambda_vsubset) auto



subsectionGRPH› is a digraph›

lemma (in 𝒵) tiny_digraph_dg_GRPH: 
  assumes "𝒵 β" and "α  β"
  shows "tiny_digraph β (dg_GRPH α)"
proof(intro tiny_digraphI)
  show "vfsequence (dg_GRPH α)" unfolding dg_GRPH_def by simp
  show "vcard (dg_GRPH α) = 4"
    unfolding dg_GRPH_def by (simp add: nat_omega_simps)
  show " (dg_GRPH αDom)  dg_GRPH αObj" by (simp add: dg_GRPH_Dom_vrange)
  show " (dg_GRPH αCod)  dg_GRPH αObj" by (simp add: dg_GRPH_Cod_vrange)
  show "dg_GRPH αObj  Vset β"
    unfolding dg_GRPH_components by (rule digraphs_in_Vset[OF assms])
  show "dg_GRPH αArr  Vset β"
    unfolding dg_GRPH_components by (rule all_dghms_in_Vset[OF assms])
qed (auto simp: assms dg_GRPH_components)



subsection‹Arrow with a domain and a codomain›

lemma dg_GRPH_is_arrI:
  assumes "𝔉 : 𝔄 ↦↦DGα𝔅" 
  shows "𝔉 : 𝔄 dg_GRPH α𝔅"
proof(intro is_arrI; unfold dg_GRPH_components)
  from assms show "𝔉  all_dghms α" by auto
  with assms show 
    "(λ𝔉all_dghms α. 𝔉HomDom)𝔉 = 𝔄" 
    "(λ𝔉all_dghms α. 𝔉HomCod)𝔉 = 𝔅"
    by (auto simp: GRPH_cs_simps)
qed

lemma dg_GRPH_is_arrD:
  assumes "𝔉 : 𝔄 dg_GRPH α𝔅"
  shows "𝔉 : 𝔄 ↦↦DGα𝔅" 
  using assms by (elim is_arrE) (auto simp: dg_GRPH_components)

lemma dg_GRPH_is_arrE:
  assumes "𝔉 : 𝔄 dg_GRPH α𝔅"
  obtains "𝔉 : 𝔄 ↦↦DGα𝔅"
  using assms by (simp add: dg_GRPH_is_arrD)

lemma dg_GRPH_is_arr_iff[GRPH_cs_simps]: 
  "𝔉 : 𝔄 dg_GRPH α𝔅  𝔉 : 𝔄 ↦↦DGα𝔅" 
  by (auto intro: dg_GRPH_is_arrI dest: dg_GRPH_is_arrD)

text‹\newpage›

end