Theory CZH_DG_CAT

(* Copyright 2021 (C) Mihails Milehins *)

sectionCAT› as a digraph\label{sec:dg_CAT}›
theory CZH_DG_CAT
  imports 
    CZH_ECAT_Functor
    CZH_ECAT_Small_Category
begin



subsection‹Background›


textCAT› is usually defined as a category of categories and functors
(e.g., see Chapter I-2 in cite"mac_lane_categories_2010").
However, there is little that can prevent one from exposing CAT›
as a digraph and provide additional structure gradually in
subsequent theories. 
Thus, in this section, α›-CAT› is defined as a digraph of categories 
and functors in the set Vα, and α›-Cat› is defined
as a digraph of tiny categories and tiny functors in Vα.
›

named_theorems dg_CAT_simps
named_theorems dg_CAT_intros



subsection‹Definition and elementary properties›

definition dg_CAT :: "V  V"
  where "dg_CAT α =
    [
      set {. category α }, 
      all_cfs α, 
      (λ𝔉all_cfs α. 𝔉HomDom), 
      (λ𝔉all_cfs α. 𝔉HomCod)
    ]"


text‹Components.›

lemma dg_CAT_components:
  shows "dg_CAT αObj = set {. category α }"
    and "dg_CAT αArr = all_cfs α"
    and "dg_CAT αDom = (λ𝔉all_cfs α. 𝔉HomDom)"
    and "dg_CAT αCod = (λ𝔉all_cfs α. 𝔉HomCod)"
  unfolding dg_CAT_def dg_field_simps by (simp_all add: nat_omega_simps)



subsection‹Object›

lemma dg_CAT_ObjI:
  assumes "category α 𝔄"
  shows "𝔄  dg_CAT αObj"
  using assms unfolding dg_CAT_components by auto

lemma dg_CAT_ObjD:
  assumes "𝔄  dg_CAT αObj"
  shows "category α 𝔄"
  using assms unfolding dg_CAT_components by auto

lemma dg_CAT_ObjE:
  assumes "𝔄  dg_CAT αObj"
  obtains "category α 𝔄"
  using assms unfolding dg_CAT_components by auto

lemma dg_CAT_Obj_iff[dg_CAT_simps]: "𝔄  dg_CAT αObj  category α 𝔄"
  unfolding dg_CAT_components by auto



subsection‹Domain and codomain›

lemma [dg_CAT_simps]:
  assumes "𝔉  all_cfs α"  
  shows dg_CAT_Dom_app: "dg_CAT αDom𝔉 = 𝔉HomDom"
    and dg_CAT_Cod_app: "dg_CAT αCod𝔉 = 𝔉HomCod"
  using assms unfolding dg_CAT_components by auto



subsectionCAT› is a digraph›

lemma (in 𝒵) tiny_category_dg_CAT: 
  assumes "𝒵 β" and "α  β"
  shows "tiny_digraph β (dg_CAT α)"
proof(intro tiny_digraphI)
  interpret β: 𝒵 β by (rule assms(1))
  show "vfsequence (dg_CAT α)" unfolding dg_CAT_def by simp
  show "vcard (dg_CAT α) = 4"
    unfolding dg_CAT_def by (simp add: nat_omega_simps)
  show " (dg_CAT αDom)  dg_CAT αObj" 
  proof(intro vsubsetI)
    fix 𝔄 assume "𝔄   (dg_CAT αDom)"
    then obtain 𝔉 where "𝔉  all_cfs α" and "𝔄 = 𝔉HomDom"
      unfolding dg_CAT_components by auto
    then obtain 𝔅 𝔉 where "𝔉 : 𝔄 ↦↦Cα𝔅" 
      unfolding dg_CAT_components by auto
    then interpret is_functor α 𝔄 𝔅 𝔉 by simp
    show "𝔄  dg_CAT αObj"
      by (simp add: dg_CAT_components HomDom.category_axioms)
  qed
  show " (dg_CAT αCod)  dg_CAT αObj"
  proof(intro vsubsetI)
    fix 𝔅 assume "𝔅   (dg_CAT αCod)"
    then obtain 𝔉 where "𝔉  𝒟 (dg_CAT αCod)" and "𝔅 = 𝔉HomCod"
      unfolding dg_CAT_components by auto
    then obtain 𝔄 𝔉 
      where 𝔉: "𝔉 : 𝔄 ↦↦Cα𝔅" and 𝔅_def: "𝔅 = 𝔉HomCod"
      unfolding dg_CAT_components by auto
    have "𝔅 = 𝔉HomCod" unfolding 𝔅_def by simp
    interpret is_functor α 𝔄 𝔅 𝔉 by (rule 𝔉)
    show "𝔅  dg_CAT αObj"
      by (simp add: HomCod.category_axioms dg_CAT_components)
  qed
  show "dg_CAT αObj  Vset β"
    unfolding dg_CAT_components by (rule categories_in_Vset[OF assms])
  show "dg_CAT αArr  Vset β"
    unfolding dg_CAT_components by (rule all_cfs_in_Vset[OF assms])
qed (simp_all add: assms dg_CAT_components)



subsection‹Arrow with a domain and a codomain›

lemma dg_CAT_is_arrI:
  assumes "𝔉 : 𝔄 ↦↦Cα𝔅" 
  shows "𝔉 : 𝔄 dg_CAT α𝔅"
proof(intro is_arrI, unfold dg_CAT_components(2))
  interpret is_functor α 𝔄 𝔅 𝔉 by (rule assms)
  from assms show "𝔉  all_cfs α" by auto
  with assms show "dg_CAT αDom𝔉 = 𝔄" "dg_CAT αCod𝔉 = 𝔅"
    by (simp_all add: dg_CAT_components cat_cs_simps)
qed 

lemma dg_CAT_is_arrD:
  assumes "𝔉 : 𝔄 dg_CAT α𝔅"
  shows "𝔉 : 𝔄 ↦↦Cα𝔅" 
  using assms by (elim is_arrE) (auto simp: dg_CAT_components)

lemma dg_CAT_is_arrE:
  assumes "𝔉 : 𝔄 dg_CAT α𝔅"
  obtains "𝔉 : 𝔄 ↦↦Cα𝔅"
  using assms by (simp add: dg_CAT_is_arrD)

lemma dg_CAT_is_arr_iff[dg_CAT_simps]: 
  "𝔉 : 𝔄 dg_CAT α𝔅  𝔉 : 𝔄 ↦↦Cα𝔅" 
  by (auto intro: dg_CAT_is_arrI dest: dg_CAT_is_arrD)

text‹\newpage›

end