Theory CZH_UCAT_Adjoints

(* Copyright 2021 (C) Mihails Milehins *)

section‹Adjoints›
theory CZH_UCAT_Adjoints
  imports 
    CZH_UCAT_Limit
    CZH_Elementary_Categories.CZH_ECAT_Yoneda
begin



subsection‹Background›

named_theorems adj_cs_simps
named_theorems adj_cs_intros
named_theorems adj_field_simps

definition AdjLeft :: V where [adj_field_simps]: "AdjLeft = 0"
definition AdjRight :: V where [adj_field_simps]: "AdjRight = 1"
definition AdjNT :: V where [adj_field_simps]: "AdjNT = 2"



subsection‹Definition and elementary properties›


text‹
See subsection 2.1 in cite"bodo_categories_1970" or Chapter IV-1 in
cite"mac_lane_categories_2010".
›

locale is_cf_adjunction =
  𝒵 α +
  vfsequence Φ +
  L: category α  +
  R: category α 𝔇 +
  LR: is_functor α  𝔇 𝔉 +
  RL: is_functor α 𝔇  𝔊 +
  NT: is_iso_ntcf 
    α 
    op_cat  ×C 𝔇 
    cat_Set α 
    HomO.Cα𝔇(𝔉-,-) 
    HomO.Cα(-,𝔊-) 
    ΦAdjNT
    for α  𝔇 𝔉 𝔊 Φ +
  assumes cf_adj_length[adj_cs_simps]: "vcard Φ = 3"
    and cf_adj_AdjLeft[adj_cs_simps]: "ΦAdjLeft = 𝔉"
    and cf_adj_AdjRight[adj_cs_simps]: "ΦAdjRight = 𝔊"

syntax "_is_cf_adjunction" :: "V  V  V  V  V  V  bool"
  ((_ : _ CF _ : _ ⇌⇌Cı _) [51, 51, 51, 51, 51] 51)
translations "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"  
  "CONST is_cf_adjunction α  𝔇 𝔉 𝔊 Φ"

lemmas [adj_cs_simps] = 
  is_cf_adjunction.cf_adj_length
  is_cf_adjunction.cf_adj_AdjLeft
  is_cf_adjunction.cf_adj_AdjRight


text‹Components.›

lemma cf_adjunction_components[adj_cs_simps]:
  "[𝔉, 𝔊, φ]AdjLeft = 𝔉"
  "[𝔉, 𝔊, φ]AdjRight = 𝔊"
  "[𝔉, 𝔊, φ]AdjNT = φ"
  unfolding AdjLeft_def AdjRight_def AdjNT_def 
  by (simp_all add: nat_omega_simps)


text‹Rules.›

lemma (in is_cf_adjunction) is_cf_adjunction_axioms'[adj_cs_intros]:
  assumes "α' = α" and "ℭ' = " and "𝔇' = 𝔇" and "𝔉' = 𝔉" and "𝔊' = 𝔊"
  shows "Φ : 𝔉' CF 𝔊' : ℭ' ⇌⇌Cα'𝔇'"  
  unfolding assms by (rule is_cf_adjunction_axioms)

lemmas (in is_cf_adjunction) [adj_cs_intros] = is_cf_adjunction_axioms

mk_ide rf is_cf_adjunction_def[unfolded is_cf_adjunction_axioms_def]
  |intro is_cf_adjunctionI|
  |dest is_cf_adjunctionD[dest]|
  |elim is_cf_adjunctionE[elim]|

lemmas [adj_cs_intros] = is_cf_adjunctionD(3-6)

lemma (in is_cf_adjunction) cf_adj_is_iso_ntcf':
  assumes "𝔉' = HomO.Cα𝔇(𝔉-,-)"
    and "𝔊' = HomO.Cα(-,𝔊-)"
    and "𝔄' = op_cat  ×C 𝔇"
    and "𝔅' = cat_Set α"
  shows "ΦAdjNT : 𝔉' CF.iso 𝔊' : 𝔄' ↦↦Cα𝔅'"
  unfolding assms by (auto intro: cat_cs_intros)

lemmas [adj_cs_intros] = is_cf_adjunction.cf_adj_is_iso_ntcf'

lemma cf_adj_eqI:
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "Φ' : 𝔉' CF 𝔊' : ℭ' ⇌⇌Cα𝔇'"
    and " = ℭ'"
    and "𝔇 = 𝔇'"
    and "𝔉 = 𝔉'"
    and "𝔊 = 𝔊'"
    and "ΦAdjNT = Φ'AdjNT"
  shows "Φ = Φ'"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Φ': is_cf_adjunction α ℭ' 𝔇' 𝔉' 𝔊' Φ' by (rule assms(2))
  show ?thesis
  proof(rule vsv_eqI)
    have dom: "𝒟 Φ = 3" 
      by (cs_concl cs_shallow cs_simp: V_cs_simps adj_cs_simps)
    show "𝒟 Φ = 𝒟 Φ'" 
      by (cs_concl cs_shallow cs_simp: V_cs_simps adj_cs_simps dom)
    from assms(4-7) have sup: 
      "ΦAdjLeft = Φ'AdjLeft" 
      "ΦAdjRight = Φ'AdjRight" 
      "ΦAdjNT = Φ'AdjNT"  
      by (simp_all add: adj_cs_simps)
    show "a  𝒟 Φ  Φa = Φ'a" for a 
      by (unfold dom, elim_in_numeral, insert sup) 
        (auto simp: adj_field_simps)
  qed (auto simp: Φ.L.vsv_axioms Φ'.vsv_axioms)
qed



subsection‹Opposite adjunction›


subsubsection‹Definition and elementary properties›


text‹See cite"kan_adjoint_1958" for further information.›

abbreviation op_cf_adj_nt :: "V  V  V  V"
  where "op_cf_adj_nt  𝔇 φ  inv_ntcf (bnt_flip (op_cat ) 𝔇 φ)"

definition op_cf_adj :: "V  V"
  where "op_cf_adj Φ =
    [
      op_cf (ΦAdjRight),
      op_cf (ΦAdjLeft),
      op_cf_adj_nt (ΦAdjLeftHomDom) (ΦAdjLeftHomCod) (ΦAdjNT)
    ]"

lemma op_cf_adj_components:
  shows "op_cf_adj ΦAdjLeft = op_cf (ΦAdjRight)"
    and "op_cf_adj ΦAdjRight = op_cf (ΦAdjLeft)"
    and "op_cf_adj ΦAdjNT = 
      op_cf_adj_nt (ΦAdjLeftHomDom) (ΦAdjLeftHomCod) (ΦAdjNT)"
  unfolding op_cf_adj_def adj_field_simps by (simp_all add: nat_omega_simps)

lemma (in is_cf_adjunction) op_cf_adj_components:
  shows "op_cf_adj ΦAdjLeft = op_cf 𝔊"
    and "op_cf_adj ΦAdjRight = op_cf 𝔉"
    and "op_cf_adj ΦAdjNT = inv_ntcf (bnt_flip (op_cat ) 𝔇 (ΦAdjNT))"
  unfolding op_cf_adj_components by (simp_all add: cat_cs_simps adj_cs_simps)

lemmas [cat_op_simps] = is_cf_adjunction.op_cf_adj_components


text‹The opposite adjunction is an adjunction.›

lemma (in is_cf_adjunction) is_cf_adjunction_op:
  ―‹See comments in subsection 2.1 in \cite{bodo_categories_1970}.›
  "op_cf_adj Φ : op_cf 𝔊 CF op_cf 𝔉 : op_cat 𝔇 ⇌⇌Cαop_cat "
proof(intro is_cf_adjunctionI, unfold cat_op_simps, unfold op_cf_adj_components)
  show "vfsequence (op_cf_adj Φ)" unfolding op_cf_adj_def by simp
  show "vcard (op_cf_adj Φ) = 3"
    unfolding op_cf_adj_def by (simp add: nat_omega_simps)
  note adj = is_cf_adjunctionD[OF is_cf_adjunction_axioms]
  from adj have f_φ: "bnt_flip (op_cat ) 𝔇 (ΦAdjNT) :
    HomO.Cαop_cat 𝔇(-,op_cf 𝔉-) CF.iso HomO.Cαop_cat (op_cf 𝔊-,-) :
    𝔇 ×C op_cat  ↦↦Cαcat_Set α"
    by 
      (
        cs_concl cs_shallow 
          cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_op_intros
      )
  show "op_cf_adj_nt  𝔇 (ΦAdjNT) :
    HomO.Cαop_cat (op_cf 𝔊-,-) CF.iso HomO.Cαop_cat 𝔇(-,op_cf 𝔉-) :
    𝔇 ×C op_cat  ↦↦Cαcat_Set α"
    by (rule CZH_ECAT_NTCF.iso_ntcf_is_iso_arr(1)[OF f_φ])
qed (auto intro: cat_cs_intros cat_op_intros)

lemmas is_cf_adjunction_op = 
  is_cf_adjunction.is_cf_adjunction_op

lemma (in is_cf_adjunction) is_cf_adjunction_op'[cat_op_intros]:
  assumes "𝔊' = op_cf 𝔊"
    and "𝔉' = op_cf 𝔉"
    and "𝔇' = op_cat 𝔇"
    and "ℭ' = op_cat "
  shows "op_cf_adj Φ : 𝔊' CF 𝔉' : 𝔇' ⇌⇌Cαℭ'"
  unfolding assms by (rule is_cf_adjunction_op)

lemmas [cat_op_intros] = is_cf_adjunction.is_cf_adjunction_op'


text‹The operation of taking the opposite adjunction is an involution.›

lemma (in is_cf_adjunction) cf_adjunction_op_cf_adj_op_cf_adj[cat_op_simps]:
  "op_cf_adj (op_cf_adj Φ) = Φ"
proof(rule cf_adj_eqI)
  show Φ': "op_cf_adj (op_cf_adj Φ) : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
  proof(intro is_cf_adjunctionI)
    show "vfsequence (op_cf_adj (op_cf_adj Φ))" unfolding op_cf_adj_def by simp
    from is_cf_adjunction_axioms show "op_cf_adj (op_cf_adj Φ)AdjNT : 
      HomO.Cα𝔇(𝔉-,-) CF.iso HomO.Cα(-,𝔊-) : 
      op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      by
        (
          cs_concl cs_shallow
            cs_intro: cat_cs_intros cat_op_intros adj_cs_intros
            cs_simp: cat_cs_simps cat_op_simps
        )
    show "vcard (op_cf_adj (op_cf_adj Φ)) = 3"
      unfolding op_cf_adj_def by (simp add: nat_omega_simps)
    from is_cf_adjunction_axioms show "op_cf_adj (op_cf_adj Φ)AdjLeft = 𝔉"
      by (cs_concl cs_shallow cs_simp: cat_op_simps cs_intro: cat_op_intros)
    from is_cf_adjunction_axioms show "op_cf_adj (op_cf_adj Φ)AdjRight = 𝔊"
      by (cs_concl cs_shallow cs_simp: cat_op_simps cs_intro: cat_op_intros)
  qed (auto intro: cat_cs_intros)
  interpret Φ': is_cf_adjunction α  𝔇 𝔉 𝔊 op_cf_adj (op_cf_adj Φ) 
    by (rule Φ')
  show "op_cf_adj (op_cf_adj Φ)AdjNT = ΦAdjNT"
  proof(rule ntcf_eqI)
    show op_op_Φ:
      "op_cf_adj (op_cf_adj Φ)AdjNT :
        HomO.Cα𝔇(𝔉-,-) CF HomO.Cα(-,𝔊-) :
        op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      by (rule Φ'.NT.is_ntcf_axioms)
    show Φ: "ΦAdjNT :
      HomO.Cα𝔇(𝔉-,-) CF HomO.Cα(-,𝔊-) : 
      op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      by (rule NT.is_ntcf_axioms)
    from op_op_Φ have dom_lhs:
      "𝒟 (op_cf_adj (op_cf_adj Φ)AdjNTNTMap) = (op_cat  ×C 𝔇)Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps)
    show "op_cf_adj (op_cf_adj Φ)AdjNTNTMap = ΦAdjNTNTMap"
    proof(rule vsv_eqI, unfold NT.ntcf_NTMap_vdomain dom_lhs)
      fix cd assume prems: "cd  (op_cat  ×C 𝔇)Obj"
      then obtain c d 
        where cd_def: "cd = [c, d]"
          and c: "c  op_cat Obj"
          and d: "d  𝔇Obj"
        by (elim cat_prod_2_ObjE[OF L.category_op R.category_axioms prems])
      from is_cf_adjunction_axioms c d L.category_axioms R.category_axioms Φ 
      show "op_cf_adj (op_cf_adj Φ)AdjNTNTMapcd = ΦAdjNTNTMapcd"
        unfolding cd_def cat_op_simps
        by
          (
            cs_concl 
              cs_intro: 
                cat_arrow_cs_intros 
                ntcf_cs_intros 
                adj_cs_intros 
                cat_op_intros 
                cat_cs_intros 
                cat_prod_cs_intros 
             cs_simp: cat_cs_simps cat_op_simps
         )
    qed (auto intro: inv_ntcf_NTMap_vsv)
  qed simp_all
qed (auto intro: adj_cs_intros)

lemmas [cat_op_simps] = is_cf_adjunction.cf_adjunction_op_cf_adj_op_cf_adj


subsubsection‹Alternative form of the naturality condition›


text‹
The lemmas in this subsection are based on the comments on page 81 in 
cite"mac_lane_categories_2010".
›

lemma (in is_cf_adjunction) cf_adj_Comp_commute_RL:
  assumes "x  Obj" 
    and "f : 𝔉ObjMapx 𝔇a"
    and "k : a 𝔇a'"
  shows 
    "𝔊ArrMapk A(ΦAdjNTNTMapx, a)ArrValf =
      (ΦAdjNTNTMapx, a')ArrValk A𝔇f"
proof-
  from 
    assms 
    is_cf_adjunction_axioms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have φ_x_a: "ΦAdjNTNTMapx, a :
    Hom 𝔇 (𝔉ObjMapx) a cat_Set αHom  x (𝔊ObjMapa)"
    by
      (
        cs_concl 
          cs_simp: cat_cs_simps
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  note φ_x_a_f = 
    cat_Set_ArrVal_app_vrange[OF φ_x_a, unfolded in_Hom_iff, OF assms(2)]
  from 
    is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have φ_x_a': 
    "ΦAdjNTNTMapx, a' :
      Hom 𝔇 (𝔉ObjMapx) a' cat_Set αHom  x (𝔊ObjMapa')"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  from is_cf_adjunction_axioms this assms have x_k:
    "[CIdx, k] : [x, a] op_cat  ×C 𝔇[x, a']"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  from 
    NT.ntcf_Comp_commute[OF this] is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have
    "ΦAdjNTNTMapx, a' Acat_Set αcf_hom 𝔇 [𝔇CId𝔉ObjMapx, k] =
      cf_hom  [CIdx, 𝔊ArrMapk] Acat_Set αΦAdjNTNTMapx, a"
    (is ?lhs = ?rhs)
    by (*slow*)
      (
        cs_prems cs_ist_simple
          cs_simp: cat_cs_simps
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  moreover from 
    is_cf_adjunction_axioms assms φ_x_a' 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have "?lhsArrValf = (ΦAdjNTNTMapx, a')ArrValk A𝔇f"
    by 
      (
        cs_concl cs_shallow
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  moreover from 
    is_cf_adjunction_axioms assms φ_x_a_f 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have
    "?rhsArrValf = 𝔊ArrMapk A(ΦAdjNTNTMapx, a)ArrValf"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  ultimately show ?thesis by simp
qed

lemma (in is_cf_adjunction) cf_adj_Comp_commute_LR:
  assumes "x  Obj" 
    and "f : 𝔉ObjMapx 𝔇a"
    and "h : x' x"
  shows
    "(ΦAdjNTNTMapx, a)ArrValf Ah =
      (ΦAdjNTNTMapx', a)ArrValf A𝔇𝔉ArrMaph"
proof-
  from 
    is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have φ_x_a: "ΦAdjNTNTMapx, a :
    Hom 𝔇 (𝔉ObjMapx) a cat_Set αHom  x (𝔊ObjMapa)"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  note φ_x_a_f = 
    cat_Set_ArrVal_app_vrange[OF φ_x_a, unfolded in_Hom_iff, OF assms(2)]
  from is_cf_adjunction_axioms assms have
    "[h, 𝔇CIda] : [x, a] op_cat  ×C 𝔇[x', a]"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  from 
    NT.ntcf_Comp_commute[OF this] is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have
    "ΦAdjNTNTMapx', a Acat_Set αcf_hom 𝔇 [𝔉ArrMaph, 𝔇CIda] =
      cf_hom  [h, CId𝔊ObjMapa] Acat_Set αΦAdjNTNTMapx, a"
    (is ?lhs = ?rhs)
    by (*slow*)
      (
        cs_prems 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )  
  moreover from 
    is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have "?lhsArrValf = (ΦAdjNTNTMapx', a)ArrValf A𝔇𝔉ArrMaph"
    by 
      (
        cs_concl
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  moreover from 
    is_cf_adjunction_axioms assms φ_x_a_f 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have "?rhsArrValf = (ΦAdjNTNTMapx, a)ArrValf Ah"
    by 
      (
        cs_concl 
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  ultimately show ?thesis by simp
qed



subsection‹Unit›


subsubsection‹Definition and elementary properties›


text‹See Chapter IV-1 in cite"mac_lane_categories_2010".›

definition cf_adjunction_unit :: "V  V" (ηC)
  where "ηC Φ =
    [
      (
        λxΦAdjLeftHomDomObj.
          (ΦAdjNTNTMapx, ΦAdjLeftObjMapx)ArrVal
            ΦAdjLeftHomCodCIdΦAdjLeftObjMapx
          
      ),
      cf_id (ΦAdjLeftHomDom),
      (ΦAdjRight) CF (ΦAdjLeft),
      ΦAdjLeftHomDom,
      ΦAdjLeftHomDom
    ]"


text‹Components.›

lemma cf_adjunction_unit_components:
  shows "ηC ΦNTMap =
    (
      λxΦAdjLeftHomDomObj.
        (ΦAdjNTNTMapx, ΦAdjLeftObjMapx)ArrVal
          ΦAdjLeftHomCodCIdΦAdjLeftObjMapx
        
    )"
    and "ηC ΦNTDom = cf_id (ΦAdjLeftHomDom)"
    and "ηC ΦNTCod = (ΦAdjRight) CF (ΦAdjLeft)"
    and "ηC ΦNTDGDom = ΦAdjLeftHomDom"
    and "ηC ΦNTDGCod = ΦAdjLeftHomDom"
  unfolding cf_adjunction_unit_def nt_field_simps 
  by (simp_all add: nat_omega_simps)

context is_cf_adjunction
begin

lemma cf_adjunction_unit_components':
  shows "ηC ΦNTMap =
    (λxObj. (ΦAdjNTNTMapx, 𝔉ObjMapx)ArrVal𝔇CId𝔉ObjMapx)"
    and "ηC ΦNTDom = cf_id "
    and "ηC ΦNTCod = 𝔊 CF 𝔉"
    and "ηC ΦNTDGDom = "
    and "ηC ΦNTDGCod = "
  unfolding cf_adjunction_unit_components
  by (cs_concl cs_shallow cs_simp: cat_cs_simps adj_cs_simps)+

mk_VLambda cf_adjunction_unit_components'(1)
  |vdomain cf_adjunction_unit_NTMap_vdomain[adj_cs_simps]|
  |app cf_adjunction_unit_NTMap_app[adj_cs_simps]|

end

mk_VLambda cf_adjunction_unit_components(1)
  |vsv cf_adjunction_unit_NTMap_vsv[adj_cs_intros]|

lemmas [adj_cs_simps] = 
  is_cf_adjunction.cf_adjunction_unit_NTMap_vdomain
  is_cf_adjunction.cf_adjunction_unit_NTMap_app


subsubsection‹Natural transformation map›

lemma (in is_cf_adjunction) cf_adjunction_unit_NTMap_is_arr: 
  assumes "x  Obj"
  shows "ηC ΦNTMapx : x 𝔊ObjMap𝔉ObjMapx"
proof-
  from 
    is_cf_adjunction_axioms assms
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have φ_x_𝔉x: 
    "ΦAdjNTNTMapx, 𝔉ObjMapx :
      Hom 𝔇 (𝔉ObjMapx) (𝔉ObjMapx) cat_Set αHom  x (𝔊ObjMap𝔉ObjMapx)"
    by 
      (
        cs_concl  
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      ) 
  from is_cf_adjunction_axioms assms have CId_𝔉x: 
    "𝔇CId𝔉ObjMapx : 𝔉ObjMapx 𝔇𝔉ObjMapx"
    by (cs_concl cs_intro: cat_cs_intros adj_cs_intros)   
  from 
    is_cf_adjunction_axioms 
    assms
    cat_Set_ArrVal_app_vrange[OF φ_x_𝔉x, unfolded in_Hom_iff, OF CId_𝔉x]
  show "ηC ΦNTMapx : x 𝔊ObjMap𝔉ObjMapx"
    by (cs_concl cs_shallow cs_simp: adj_cs_simps cs_intro: cat_cs_intros)
qed

lemma (in is_cf_adjunction) cf_adjunction_unit_NTMap_is_arr': 
  assumes "x  Obj"
    and "a = x"
    and "b = 𝔊ObjMap𝔉ObjMapx"
    and "ℭ' = "
  shows "ηC ΦNTMapx : x ℭ'b"
  using assms(1) unfolding assms(2-4) by (rule cf_adjunction_unit_NTMap_is_arr)

lemmas [adj_cs_intros] = is_cf_adjunction.cf_adjunction_unit_NTMap_is_arr'

lemma (in is_cf_adjunction) cf_adjunction_unit_NTMap_vrange: 
  " (ηC ΦNTMap)  Arr"
proof(rule vsv.vsv_vrange_vsubset, unfold cf_adjunction_unit_NTMap_vdomain)
  fix x assume prems: "x  Obj"
  from cf_adjunction_unit_NTMap_is_arr[OF prems] show "ηC ΦNTMapx  Arr"
    by auto
qed (auto intro: adj_cs_intros)


subsubsection‹Unit is a natural transformation›

lemma (in is_cf_adjunction) cf_adjunction_unit_is_ntcf:
  "ηC Φ : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
proof(intro is_ntcfI')
  show "vfsequence (ηC Φ)" unfolding cf_adjunction_unit_def by simp
  show "vcard (ηC Φ) = 5"
    unfolding cf_adjunction_unit_def by (simp add: nat_omega_simps)
  from is_cf_adjunction_axioms show "cf_id  :  ↦↦Cα"
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  from is_cf_adjunction_axioms show "𝔊 CF 𝔉 :  ↦↦Cα"
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  from is_cf_adjunction_axioms show "𝒟 (ηC ΦNTMap) = Obj"
    by (cs_concl cs_shallow cs_simp: adj_cs_simps cs_intro: cat_cs_intros)
  show "ηC ΦNTMapa : cf_id ObjMapa (𝔊 CF 𝔉)ObjMapa"
    if "a  Obj" for a
    using is_cf_adjunction_axioms that 
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  show
    "ηC ΦNTMapb Acf_id ArrMapf =
      (𝔊 CF 𝔉)ArrMapf AηC ΦNTMapa"
    if "f : a b" for a b f
    using is_cf_adjunction_axioms that
    by 
      (
        cs_concl 
          cs_simp: 
            cf_adj_Comp_commute_RL cf_adj_Comp_commute_LR 
            cat_cs_simps  
            adj_cs_simps 
          cs_intro: cat_cs_intros adj_cs_intros
      )
qed (auto simp: cf_adjunction_unit_components')

lemma (in is_cf_adjunction) cf_adjunction_unit_is_ntcf':
  assumes "𝔖 = cf_id "
    and "𝔖' = 𝔊 CF 𝔉"
    and "𝔄 = "
    and "𝔅 = "
  shows "ηC Φ : 𝔖 CF 𝔖' : 𝔄 ↦↦Cα𝔅"
  unfolding assms by (rule cf_adjunction_unit_is_ntcf)

lemmas [adj_cs_intros] = is_cf_adjunction.cf_adjunction_unit_is_ntcf'


subsubsection‹Every component of a unit is a universal arrow›


text‹
The lemmas in this subsection are based on elements of the statement of 
Theorem 1 in Chapter IV-1 in cite"mac_lane_categories_2010".
›

lemma (in is_cf_adjunction) cf_adj_umap_of_unit:
  assumes "x  Obj" and "a  𝔇Obj"
  shows "ΦAdjNTNTMapx, a = umap_of 𝔊 x (𝔉ObjMapx) (ηC ΦNTMapx) a"
  (is ΦAdjNTNTMapx, a = ?uof_a)
proof-

  from 
    is_cf_adjunction_axioms assms 
    L.category_axioms R.category_axioms (*speedup*)
    L.category_op R.category_op (*speedup*)
  have φ_xa: "ΦAdjNTNTMapx, a :
    Hom 𝔇 (𝔉ObjMapx) a cat_Set αHom  x (𝔊ObjMapa)"
    by
      (
        cs_concl
          cs_simp: cat_cs_simps 
          cs_intro: cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
      )
  then have dom_lhs:
    "𝒟 ((ΦAdjNTNTMapx, a)ArrVal) = Hom 𝔇 (𝔉ObjMapx) a"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps)
  from is_cf_adjunction_axioms assms have uof_a:
    "?uof_a : Hom 𝔇 (𝔉ObjMapx) a cat_Set αHom  x (𝔊ObjMapa)"
    by (cs_concl cs_intro: cat_cs_intros adj_cs_intros)
  then have dom_rhs: "𝒟 (?uof_aArrVal) = Hom 𝔇 (𝔉ObjMapx) a"
    by (cs_concl cs_simp: cat_cs_simps)

  show ?thesis
  proof(rule arr_Set_eqI[of α])
    from φ_xa show arr_Set_φ_xa: "arr_Set α (ΦAdjNTNTMapx, a)"
      by (auto dest: cat_Set_is_arrD(1))
    from uof_a show arr_Set_uof_a: "arr_Set α ?uof_a" 
      by (auto dest: cat_Set_is_arrD(1))
    show "(ΦAdjNTNTMapx, a)ArrVal = ?uof_aArrVal"
    proof(rule vsv_eqI, unfold dom_lhs dom_rhs in_Hom_iff)
      fix g assume prems: "g : 𝔉ObjMapx 𝔇a"
      from is_cf_adjunction_axioms assms prems show
        "(ΦAdjNTNTMapx, a)ArrValg = ?uof_aArrValg"
        by
          (
            cs_concl cs_shallow
              cs_simp:
                cf_adj_Comp_commute_RL
                adj_cs_simps
                cat_cs_simps
                cat_op_simps
                cat_prod_cs_simps
              cs_intro:
                adj_cs_intros
                ntcf_cs_intros
                cat_cs_intros
                cat_op_intros
                cat_prod_cs_intros
          )
    qed (use arr_Set_φ_xa arr_Set_uof_a in auto)
  
  qed (use φ_xa uof_a in cs_concl cs_shallow cs_simp: cat_cs_simps)+

qed

lemma (in is_cf_adjunction) cf_adj_umap_of_unit':
  assumes "x  Obj" 
    and "a  𝔇Obj"
    and "η = ηC ΦNTMapx"
    and "𝔉x = 𝔉ObjMapx"
  shows "ΦAdjNTNTMapx, a = umap_of 𝔊 x 𝔉x η a"
  using assms(1,2) unfolding assms(3,4) by (rule cf_adj_umap_of_unit)

lemma (in is_cf_adjunction) cf_adjunction_unit_component_is_ua_of:
  assumes "x  Obj"
  shows "universal_arrow_of 𝔊 x (𝔉ObjMapx) (ηC ΦNTMapx)"
    (is universal_arrow_of 𝔊 x (𝔉ObjMapx) ?ηx)
proof(rule RL.cf_ua_of_if_ntcf_ua_of_is_iso_ntcf)
  from is_cf_adjunction_axioms assms show "𝔉ObjMapx  𝔇Obj"
    by (cs_concl cs_shallow cs_intro: cat_cs_intros adj_cs_intros)
  from is_cf_adjunction_axioms assms show 
    "ηC ΦNTMapx : x 𝔊ObjMap𝔉ObjMapx"
    by (cs_concl cs_shallow cs_intro: cat_cs_intros adj_cs_intros)
  show 
    "ntcf_ua_of α 𝔊 x (𝔉ObjMapx) (ηC ΦNTMapx) :
      HomO.Cα𝔇(𝔉ObjMapx,-) CF.iso HomO.Cα(x,-) CF 𝔊 :
      𝔇 ↦↦Cαcat_Set α"
    (is ?ntcf_ua_of : ?H𝔉 CF.iso ?H𝔊 : 𝔇 ↦↦Cαcat_Set α)
  proof(rule is_iso_ntcfI)
    from is_cf_adjunction_axioms assms show 
      "?ntcf_ua_of : ?H𝔉 CF ?H𝔊 : 𝔇 ↦↦Cαcat_Set α"
      by (intro RL.cf_ntcf_ua_of_is_ntcf) 
        (cs_concl cs_shallow cs_intro: cat_cs_intros adj_cs_intros)+
    fix a assume prems: "a  𝔇Obj"
    from assms prems have 
      "ΦAdjNTNTMapx, a = umap_of 𝔊 x (𝔉ObjMapx) ?ηx a"
      (is ΦAdjNTNTMapx, a = ?uof_a)
      by (rule cf_adj_umap_of_unit)
    from assms prems L.category_axioms R.category_axioms have
      "[x, a]  (op_cat  ×C 𝔇)Obj"
      by (cs_concl cs_shallow cs_intro:  cat_op_intros cat_prod_cs_intros)
    from 
      NT.iso_ntcf_is_iso_arr[
        OF this, unfolded cf_adj_umap_of_unit[OF assms prems]
        ]
      is_cf_adjunction_axioms assms prems
      L.category_axioms R.category_axioms
    have "?uof_a : Hom 𝔇 (𝔉ObjMapx) a isocat_Set αHom  x (𝔊ObjMapa)"
      by 
        (
          cs_prems
            cs_simp: cat_cs_simps 
            cs_intro: 
              cat_cs_intros cat_op_intros adj_cs_intros cat_prod_cs_intros
        )
    with is_cf_adjunction_axioms assms prems show 
      "?ntcf_ua_ofNTMapa : ?H𝔉ObjMapa isocat_Set α?H𝔊ObjMapa"
      by 
        (
          cs_concl
            cs_simp: cat_cs_simps 
            cs_intro: cat_cs_intros cat_op_intros adj_cs_intros
        )
  qed
qed



subsection‹Counit›


subsubsection‹Definition and elementary properties›

definition cf_adjunction_counit :: "V  V" (εC)
  where "εC Φ =
    [
      (
        λxΦAdjLeftHomCodObj.
          (ΦAdjNTNTMapΦAdjRightObjMapx, x)¯SetArrVal
            ΦAdjLeftHomDomCIdΦAdjRightObjMapx
            
      ), 
      (ΦAdjLeft) CF (ΦAdjRight),
      cf_id (ΦAdjLeftHomCod),
      ΦAdjLeftHomCod,
      ΦAdjLeftHomCod
    ]"


text‹Components.›

lemma cf_adjunction_counit_components:
  shows "εC ΦNTMap =
    (
      λxΦAdjLeftHomCodObj.
        (ΦAdjNTNTMapΦAdjRightObjMapx, x)¯SetArrVal
          ΦAdjLeftHomDomCIdΦAdjRightObjMapx
          
    )"
    and "εC ΦNTDom = (ΦAdjLeft) CF (ΦAdjRight)"
    and "εC ΦNTCod = cf_id (ΦAdjLeftHomCod)"
    and "εC ΦNTDGDom = ΦAdjLeftHomCod"
    and "εC ΦNTDGCod = ΦAdjLeftHomCod"
  unfolding cf_adjunction_counit_def nt_field_simps 
  by (simp_all add: nat_omega_simps)

context is_cf_adjunction
begin

lemma cf_adjunction_counit_components':
  shows "εC ΦNTMap =
    (
      λx𝔇Obj.
        (ΦAdjNTNTMap𝔊ObjMapx, x)¯SetArrValCId𝔊ObjMapx
    )"
    and "εC ΦNTDom = 𝔉 CF 𝔊"
    and "εC ΦNTCod = cf_id 𝔇"
    and "εC ΦNTDGDom = 𝔇"
    and "εC ΦNTDGCod = 𝔇"
  unfolding cf_adjunction_counit_components
  by (cs_concl cs_shallow cs_simp: cat_cs_simps adj_cs_simps)+

mk_VLambda cf_adjunction_counit_components'(1)
  |vdomain cf_adjunction_counit_NTMap_vdomain[adj_cs_simps]|
  |app cf_adjunction_counit_NTMap_app[adj_cs_simps]|

end

mk_VLambda cf_adjunction_counit_components(1)
  |vsv cf_adjunction_counit_NTMap_vsv[adj_cs_intros]|

lemmas [adj_cs_simps] = 
  is_cf_adjunction.cf_adjunction_counit_NTMap_vdomain
  is_cf_adjunction.cf_adjunction_counit_NTMap_app


subsubsection‹Duality for the unit and counit›

lemma (in is_cf_adjunction) cf_adjunction_unit_NTMap_op:
  "ηC (op_cf_adj Φ)NTMap = εC ΦNTMap"
proof-
  interpret op_Φ: 
    is_cf_adjunction α op_cat 𝔇 op_cat  op_cf 𝔊 op_cf 𝔉 op_cf_adj Φ
    by (rule is_cf_adjunction_op)
  show ?thesis
  proof
    (
      rule vsv_eqI, 
      unfold 
        cf_adjunction_counit_NTMap_vdomain 
        op_Φ.cf_adjunction_unit_NTMap_vdomain
    )
    fix a assume prems: "a  op_cat 𝔇Obj"
    then have a: "a  𝔇Obj" unfolding cat_op_simps by simp
    from is_cf_adjunction_axioms a show 
      "ηC (op_cf_adj Φ)NTMapa = εC ΦNTMapa"
      by 
        (
          cs_concl cs_shallow
            cs_simp: cat_Set_cs_simps cat_cs_simps cat_op_simps adj_cs_simps 
            cs_intro: 
              cat_arrow_cs_intros cat_cs_intros cat_op_intros cat_prod_cs_intros
        )
  qed 
    (
      simp_all add: 
        cat_op_simps cf_adjunction_counit_NTMap_vsv cf_adjunction_unit_NTMap_vsv
    )
qed


lemmas [cat_op_simps] = is_cf_adjunction.cf_adjunction_unit_NTMap_op

lemma (in is_cf_adjunction) cf_adjunction_counit_NTMap_op:
  "εC (op_cf_adj Φ)NTMap = ηC ΦNTMap"
  by 
    (
      rule is_cf_adjunction.cf_adjunction_unit_NTMap_op[
        OF is_cf_adjunction_op,
        unfolded is_cf_adjunction.cf_adjunction_op_cf_adj_op_cf_adj[
          OF is_cf_adjunction_axioms
          ],
        unfolded cat_op_simps,
        symmetric
      ]
   )

lemmas [cat_op_simps] = is_cf_adjunction.cf_adjunction_counit_NTMap_op

lemma (in is_cf_adjunction) op_ntcf_cf_adjunction_counit:
  "op_ntcf (εC Φ) = ηC (op_cf_adj Φ)"
  (is  = )
proof(rule vsv_eqI)
  interpret op_Φ: 
    is_cf_adjunction α op_cat 𝔇 op_cat  op_cf 𝔊 op_cf 𝔉 op_cf_adj Φ
    by (rule is_cf_adjunction_op)
  have dom_lhs: "𝒟  = 5" unfolding op_ntcf_def by (simp add: nat_omega_simps)
  have dom_rhs: "𝒟  = 5" 
    unfolding cf_adjunction_unit_def by (simp add: nat_omega_simps)
  show "𝒟  = 𝒟 " unfolding dom_lhs dom_rhs by simp
  show "a  𝒟   a = a" for a
    by 
      (
        unfold dom_lhs, 
        elim_in_numeral, 
        fold nt_field_simps, 
        unfold cf_adjunction_unit_NTMap_op,
        unfold 
          cf_adjunction_counit_components' 
          cf_adjunction_unit_components'
          op_Φ.cf_adjunction_counit_components' 
          op_Φ.cf_adjunction_unit_components'
          cat_op_simps
      )
      simp_all
qed (auto simp: op_ntcf_def cf_adjunction_unit_def)

lemmas [cat_op_simps] = is_cf_adjunction.op_ntcf_cf_adjunction_counit

lemma (in is_cf_adjunction) op_ntcf_cf_adjunction_unit:
  "op_ntcf (ηC Φ) = εC (op_cf_adj Φ)"
  (is  = )
proof(rule vsv_eqI)
  interpret op_Φ: 
    is_cf_adjunction α op_cat 𝔇 op_cat  op_cf 𝔊 op_cf 𝔉 op_cf_adj Φ
    by (rule is_cf_adjunction_op)
  have dom_lhs: "𝒟  = 5" 
    unfolding op_ntcf_def by (simp add: nat_omega_simps)
  have dom_rhs: "𝒟  = 5" 
    unfolding cf_adjunction_counit_def by (simp add: nat_omega_simps)
  show "𝒟  = 𝒟 " unfolding dom_lhs dom_rhs by simp
  show "a  𝒟   a = a" for a
    by 
      (
        unfold dom_lhs, 
        elim_in_numeral, 
        fold nt_field_simps, 
        unfold cf_adjunction_counit_NTMap_op,
        unfold 
          cf_adjunction_counit_components' 
          cf_adjunction_unit_components'
          op_Φ.cf_adjunction_counit_components' 
          op_Φ.cf_adjunction_unit_components'
          cat_op_simps
      )
      simp_all
qed (auto simp: op_ntcf_def cf_adjunction_counit_def)

lemmas [cat_op_simps] = is_cf_adjunction.op_ntcf_cf_adjunction_unit


subsubsection‹Natural transformation map›

lemma (in is_cf_adjunction) cf_adjunction_counit_NTMap_is_arr: 
  assumes "x  𝔇Obj"
  shows "εC ΦNTMapx : 𝔉ObjMap𝔊ObjMapx 𝔇x"
proof-
  from assms have x: "x  op_cat 𝔇Obj" unfolding cat_op_simps by simp
  show ?thesis
    by 
      (
        rule is_cf_adjunction.cf_adjunction_unit_NTMap_is_arr[
          OF is_cf_adjunction_op x, 
          unfolded cf_adjunction_unit_NTMap_op cat_op_simps
          ]
      )
qed

lemma (in is_cf_adjunction) cf_adjunction_counit_NTMap_is_arr': 
  assumes "x  𝔇Obj"
    and "a = 𝔉ObjMap𝔊ObjMapx"
    and "b = x"
    and "𝔇' = 𝔇"
  shows "εC ΦNTMapx : a 𝔇'b"
  using assms(1) unfolding assms(2-4) by (rule cf_adjunction_counit_NTMap_is_arr)

lemmas [adj_cs_intros] = is_cf_adjunction.cf_adjunction_counit_NTMap_is_arr'

lemma (in is_cf_adjunction) cf_adjunction_counit_NTMap_vrange: 
  " (εC ΦNTMap)  𝔇Arr"
  by 
    (
      rule is_cf_adjunction.cf_adjunction_unit_NTMap_vrange[
        OF is_cf_adjunction_op,
        unfolded cf_adjunction_unit_NTMap_op cat_op_simps
        ]
    )


subsubsection‹Counit is a natural transformation›

lemma (in is_cf_adjunction) cf_adjunction_counit_is_ntcf:
  "εC Φ : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
proof-
  from is_cf_adjunction.cf_adjunction_unit_is_ntcf[OF is_cf_adjunction_op] have 
    "εC Φ :
      op_cf (op_cf 𝔉 CF op_cf 𝔊) CF op_cf (cf_id (op_cat 𝔇)) :
      op_cat (op_cat 𝔇) ↦↦Cαop_cat (op_cat 𝔇)"
    unfolding
      is_cf_adjunction.op_ntcf_cf_adjunction_unit[
        OF is_cf_adjunction_op, unfolded cat_op_simps, symmetric
        ]
    by (rule is_ntcf.is_ntcf_op)
  then show ?thesis unfolding cat_op_simps .
qed

lemma (in is_cf_adjunction) cf_adjunction_counit_is_ntcf':
  assumes "𝔖 = 𝔉 CF 𝔊"
    and "𝔖' = cf_id 𝔇"
    and "𝔄 = 𝔇"
    and "𝔅 = 𝔇"
  shows "εC Φ : 𝔖 CF 𝔖' : 𝔄 ↦↦Cα𝔅"
  unfolding assms by (rule cf_adjunction_counit_is_ntcf)

lemmas [adj_cs_intros] = is_cf_adjunction.cf_adjunction_counit_is_ntcf'


subsubsection‹Every component of a counit is a universal arrow›

text‹
The lemmas in this subsection are based on elements of the statement of 
Theorem 1 in Chapter IV-1 in cite"mac_lane_categories_2010".
›

lemma (in is_cf_adjunction) cf_adj_umap_fo_counit:
  assumes "x  𝔇Obj" and "a  Obj"
  shows "op_cf_adj ΦAdjNTNTMapx, a =
    umap_fo 𝔉 x (𝔊ObjMapx) (εC ΦNTMapx) a"
  by
    (
      rule is_cf_adjunction.cf_adj_umap_of_unit[
        OF is_cf_adjunction_op,
        unfolded cat_op_simps,
        OF assms,
        unfolded cf_adjunction_unit_NTMap_op
        ]
    )

lemma (in is_cf_adjunction) cf_adjunction_counit_component_is_ua_fo:
  assumes "x  𝔇Obj"
  shows "universal_arrow_fo 𝔉 x (𝔊ObjMapx) (εC ΦNTMapx)"
  by 
    (
      rule is_cf_adjunction.cf_adjunction_unit_component_is_ua_of[
        OF is_cf_adjunction_op, 
        unfolded cat_op_simps, 
        OF assms,
        unfolded cf_adjunction_unit_NTMap_op
        ]
    )


subsubsection‹Further properties›

lemma (in is_cf_adjunction) cf_adj_AdjNT_cf_adjunction_unit:
  ―‹See Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "x  Obj" and "f : 𝔉ObjMapx 𝔇a"
  shows 
    "𝔊ArrMapf AηC ΦNTMapx =
      (ΦAdjNTNTMapx, a)ArrValf"
proof-
  from assms(1) have "𝔇CId𝔉ObjMapx : 𝔉ObjMapx 𝔇𝔉ObjMapx"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
  from cf_adj_Comp_commute_RL[OF assms(1) this assms(2)] assms show ?thesis
    by
      (
        cs_prems cs_shallow 
          cs_simp: 
            cat_cs_simps
            is_cf_adjunction.cf_adjunction_unit_NTMap_app[symmetric]
          cs_intro: adj_cs_intros
      )
qed

lemma (in is_cf_adjunction) cf_adj_AdjNT_cf_adjunction_counit:
  ―‹See Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "x  𝔇Obj" and "g : a 𝔊ObjMapx"
  shows
    "εC ΦNTMapx A𝔇𝔉ArrMapg =
      (ΦAdjNTNTMapa, x)¯Ccat_Set αArrValg"
  using
    is_cf_adjunction.cf_adj_AdjNT_cf_adjunction_unit
      [
        OF is_cf_adjunction_op, 
        unfolded cat_op_simps cf_adjunction_unit_NTMap_op, 
        OF assms
      ]
    assms
  by (*slow*)
    (
      cs_prems
        cs_simp: cat_cs_simps cat_op_simps
        cs_intro:
          cat_cs_intros
          adj_cs_intros
          cat_op_intros
          cat_prod_cs_intros
    )

lemma (in is_cf_adjunction) cf_adj_counit_unit_app[adj_cs_simps]:
  ―‹See Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "x  𝔇Obj" and "g : a 𝔊ObjMapx"
  shows "𝔊ArrMapεC ΦNTMapx A𝔇𝔉ArrMapg AηC ΦNTMapa = g"
proof-
  from assms(2) have a: "a  Obj" by auto
  from assms have inv_Φ_g: 
    "(ΦAdjNTNTMapa, x)¯Ccat_Set αArrValg : 𝔉ObjMapa 𝔇x"
    by (*slow*)
      (
        cs_concl 
          cs_simp: cat_cs_simps cat_op_simps
          cs_intro:
            cat_arrow_cs_intros
            cat_cs_intros
            adj_cs_intros
            cat_prod_cs_intros
            cat_op_intros
      )
  from assms show ?thesis
    unfolding
      cf_adj_AdjNT_cf_adjunction_counit[OF assms]
      cf_adj_AdjNT_cf_adjunction_unit[OF a inv_Φ_g]
    by (*slow*)
      (
        cs_concl 
          cs_simp: cat_cs_simps cat_op_simps
          cs_intro:
            cat_arrow_cs_intros 
            cat_cs_intros 
            adj_cs_intros 
            cat_prod_cs_intros 
            cat_op_intros
      )
qed

lemmas [cat_cs_simps] = is_cf_adjunction.cf_adj_counit_unit_app

lemma (in is_cf_adjunction) cf_adj_unit_counit_app[adj_cs_simps]:
  ―‹See Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "x  Obj" and "f : 𝔉ObjMapx 𝔇a"
  shows "εC ΦNTMapa A𝔇𝔉ArrMap𝔊ArrMapf AηC ΦNTMapx = f"
proof-
  from assms(2) have a: "a  𝔇Obj" by auto
  from assms have Φ_f: 
    "(ΦAdjNTNTMapx, a)ArrValf : x 𝔊ObjMapa"
    by
      (
        cs_concl 
          cs_simp: cat_cs_simps cat_op_simps 
          cs_intro:
            cat_arrow_cs_intros
            cat_cs_intros 
            adj_cs_intros
            cat_prod_cs_intros
            cat_op_intros
      )
  from assms show ?thesis
    unfolding
      cf_adj_AdjNT_cf_adjunction_unit[OF assms]
      cf_adj_AdjNT_cf_adjunction_counit[OF a Φ_f]
    by
      (
        cs_concl 
          cs_simp: cat_cs_simps cat_op_simps
          cs_intro: 
            cat_arrow_cs_intros
            cat_cs_intros
            adj_cs_intros
            cat_prod_cs_intros
            cat_op_intros
      )
qed

lemmas [cat_cs_simps] = is_cf_adjunction.cf_adj_unit_counit_app



subsection‹Counit-unit equations›


text‹
The following equations appear as part of the statement of 
Theorem 1 in Chapter IV-1 in cite"mac_lane_categories_2010".
These equations also appear in cite"noauthor_wikipedia_2001",
where they are named counit-unit equations›.
›

lemma (in is_cf_adjunction) cf_adjunction_counit_unit:
  "(𝔊 CF-NTCF εC Φ) NTCF (ηC Φ NTCF-CF 𝔊) = ntcf_id 𝔊"
  (is (𝔊 CF-NTCF ) NTCF ( NTCF-CF 𝔊) = ntcf_id 𝔊)
proof(rule ntcf_eqI)
  from is_cf_adjunction_axioms show 
    "(𝔊 CF-NTCF ) NTCF ( NTCF-CF 𝔊) : 𝔊 CF 𝔊 : 𝔇 ↦↦Cα"
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  show "ntcf_id 𝔊 : 𝔊 CF 𝔊 : 𝔇 ↦↦Cα"
    by (rule is_functor.cf_ntcf_id_is_ntcf[OF RL.is_functor_axioms])
  from is_cf_adjunction_axioms have dom_lhs:
    "𝒟 (((𝔊 CF-NTCF ) NTCF ( NTCF-CF 𝔊))NTMap) = 𝔇Obj"
    by 
      (
        cs_concl cs_shallow 
          cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros
      )
  from is_cf_adjunction_axioms have dom_rhs: "𝒟 (ntcf_id 𝔊NTMap) = 𝔇Obj"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: adj_cs_intros)
  show "((𝔊 CF-NTCF ) NTCF ( NTCF-CF 𝔊))NTMap = ntcf_id 𝔊NTMap"
  proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
    fix a assume prems: "a  𝔇Obj"
    let ?φ_aa = ΦAdjNTNTMap𝔊ObjMapa, a
    have "category α (cat_Set α)"
      by (rule category_cat_Set)
    from is_cf_adjunction_axioms prems
      L.category_axioms R.category_axioms (*speedup*)
      L.category_op R.category_op (*speedup*)
      LR.is_functor_axioms RL.is_functor_axioms (*speedup*)
      category_cat_Set (*speedup*)
    have
      "?φ_aaArrValNTMapa =
        (?φ_aa Acat_Set α?φ_aa¯Ccat_Set α)ArrValCId𝔊ObjMapa"
      by 
        (
          cs_concl cs_shallow
            cs_simp: 
              𝒵.cat_Set_Comp_ArrVal 
              cat_Set_the_inverse[symmetric] 
              cat_cs_simps adj_cs_simps cat_prod_cs_simps 
            cs_intro:
              cat_arrow_cs_intros 
              cat_cs_intros 
              cat_op_intros 
              adj_cs_intros 
              cat_prod_cs_intros
        )
    also from 
      is_cf_adjunction_axioms prems 
      L.category_axioms R.category_axioms (*speedup*)
      L.category_op R.category_op (*speedup*)
      LR.is_functor_axioms RL.is_functor_axioms (*speedup*)
      category_cat_Set (*speedup*)   
    have " = CId𝔊ObjMapa"
      by 
        (
          cs_concl
            cs_simp: 
              cat_cs_simps
              cat_Set_components(1)
              category.cat_the_inverse_Comp_CId
            cs_intro:
              cat_arrow_cs_intros
              cat_cs_intros
              cat_op_intros
              cat_prod_cs_intros
        )
    finally have [cat_cs_simps]: 
      "?φ_aaArrValNTMapa = CId𝔊ObjMapa"
      by simp
    from 
      prems is_cf_adjunction_axioms 
      L.category_axioms R.category_axioms (*speedup*)
    show "((𝔊 CF-NTCF ) NTCF ( NTCF-CF 𝔊))NTMapa = ntcf_id 𝔊NTMapa"
      by
        (
          cs_concl
            cs_simp:
              cat_Set_the_inverse[symmetric]
              cf_adj_Comp_commute_RL
              cat_cs_simps
              adj_cs_simps
              cat_prod_cs_simps
              cat_op_simps
            cs_intro:
              cat_arrow_cs_intros
              cat_cs_intros
              adj_cs_intros
              cat_prod_cs_intros
              cat_op_intros
        )

  qed (auto intro: cat_cs_intros)

qed simp_all

lemmas [adj_cs_simps] = is_cf_adjunction.cf_adjunction_counit_unit

lemma (in is_cf_adjunction) cf_adjunction_unit_counit:
  "(εC Φ NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF ηC Φ) = ntcf_id 𝔉"
  (is ( NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF ) = ntcf_id 𝔉)
proof-
  from is_cf_adjunction_axioms have 𝔉η:
    "𝔉 CF-NTCF  : 𝔉 CF 𝔉 CF 𝔊 CF 𝔉 :  ↦↦Cα𝔇"
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  from is_cf_adjunction_axioms have ε𝔉:
    " NTCF-CF 𝔉 : 𝔉 CF 𝔊 CF 𝔉 CF 𝔉 :  ↦↦Cα𝔇"
    by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
  from 𝔉η ε𝔉 have ε𝔉_𝔉η: 
    "( NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF ) : 𝔉 CF 𝔉 :  ↦↦Cα𝔇"
    by (cs_concl cs_shallow cs_intro: cat_cs_intros)
  from 
    is_cf_adjunction.cf_adjunction_counit_unit[
      OF is_cf_adjunction_op, 
      unfolded 
        op_ntcf_cf_adjunction_unit[symmetric]
        op_ntcf_cf_adjunction_counit[symmetric]
        op_ntcf_cf_ntcf_comp[symmetric]
        op_ntcf_ntcf_cf_comp[symmetric]
        op_ntcf_ntcf_vcomp[symmetric]
        op_ntcf_ntcf_vcomp[symmetric, OF ε𝔉 𝔉η]
        LR.cf_ntcf_id_op_cf
      ]
  have 
    "op_ntcf (op_ntcf (( NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF ))) =
      op_ntcf (op_ntcf (ntcf_id 𝔉))"
    by simp
  from this is_cf_adjunction_axioms ε𝔉_𝔉η show ?thesis
    by 
      (
        cs_prems cs_shallow 
          cs_simp: cat_op_simps cs_intro: cat_cs_intros cat_prod_cs_intros 
      )
qed

lemmas [adj_cs_simps] = is_cf_adjunction.cf_adjunction_unit_counit



subsection‹
Construction of an adjunction from universal morphisms 
from objects to functors
›


text‹
The subsection presents the construction of an adjunction given 
a structured collection of universal morphisms from objects to functors.
The content of this subsection follows the statement and the proof
of Theorem 2-i in Chapter IV-1 in cite"mac_lane_categories_2010".
›


subsubsection‹
The natural transformation associated with the adjunction
constructed from universal morphisms from objects to functors
›

definition cf_adjunction_AdjNT_of_unit :: "V  V  V  V  V"
  where "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η =
    [
      (λcd(op_cat (𝔉HomDom) ×C 𝔉HomCod)Obj.
        umap_of 𝔊 (cd0) (𝔉ObjMapcd0) (ηNTMapcd0) (cd1)),
      HomO.Cα𝔉HomCod(𝔉-,-),
      HomO.Cα𝔉HomDom(-,𝔊-),
      op_cat (𝔉HomDom) ×C (𝔉HomCod),
      cat_Set α
    ]"


text‹Components.›

lemma cf_adjunction_AdjNT_of_unit_components:
  shows "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap =
    (
      λcd(op_cat (𝔉HomDom) ×C 𝔉HomCod)Obj.
        umap_of 𝔊 (cd0) (𝔉ObjMapcd0) (ηNTMapcd0)  (cd1)
    )"
    and "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTDom = HomO.Cα𝔉HomCod(𝔉-,-)"
    and "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTCod = HomO.Cα𝔉HomDom(-,𝔊-)"
    and "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTDGDom =
      op_cat (𝔉HomDom) ×C (𝔉HomCod)"
    and "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTDGCod = cat_Set α"
  unfolding cf_adjunction_AdjNT_of_unit_def nt_field_simps
  by (simp_all add: nat_omega_simps)


subsubsection‹Natural transformation map›

lemma cf_adjunction_AdjNT_of_unit_NTMap_vsv[adj_cs_intros]:
  "vsv (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap)"
  unfolding cf_adjunction_AdjNT_of_unit_components by simp

lemma cf_adjunction_AdjNT_of_unit_NTMap_vdomain[adj_cs_simps]:
  assumes "𝔉 :  ↦↦Cα𝔇"
  shows "𝒟 (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap) = (op_cat  ×C 𝔇)Obj"
proof-
  interpret is_functor α  𝔇 𝔉 by (rule assms(1))
  show ?thesis 
    unfolding cf_adjunction_AdjNT_of_unit_components 
    by (simp add: cat_cs_simps)
qed

lemma cf_adjunction_AdjNT_of_unit_NTMap_app[adj_cs_simps]:
  assumes "𝔉 :  ↦↦Cα𝔇" and "c  Obj" and "d  𝔇Obj"
  shows 
    "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMapc, d =
      umap_of 𝔊 c (𝔉ObjMapc) (ηNTMapc) d"
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(1))
  from assms have "[c, d]  (op_cat  ×C 𝔇)Obj"
    by 
      (
        cs_concl cs_shallow 
          cs_simp: cat_op_simps cs_intro: cat_cs_intros cat_prod_cs_intros
      )
  then show "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap c, d = 
    umap_of 𝔊 c (𝔉ObjMapc) (ηNTMapc) d"
    unfolding cf_adjunction_AdjNT_of_unit_components 
    by (simp add: nat_omega_simps cat_cs_simps)
qed

lemma cf_adjunction_AdjNT_of_unit_NTMap_vrange:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
  shows " (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap)  cat_Set αArr"
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  show ?thesis
  proof
    (
      rule vsv.vsv_vrange_vsubset, 
      unfold cf_adjunction_AdjNT_of_unit_NTMap_vdomain[OF assms(3)]
    )
    show "vsv (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap)" 
      by (intro adj_cs_intros)
    fix cd assume prems: "cd  (op_cat  ×C 𝔇)Obj"
    then obtain c d where cd_def: "cd = [c, d]"
      and c: "c  Obj"
      and d: "d  𝔇Obj"
      by 
        (
          auto 
            simp: cat_op_simps 
            elim: 
              cat_prod_2_ObjE[OF 𝔉.HomDom.category_op 𝔉.HomCod.category_axioms]
        )
    from assms c d show 
      "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMapcd  cat_Set αArr"
      unfolding cd_def
      by 
        (
          cs_concl  
            cs_simp: cat_cs_simps adj_cs_simps cs_intro: cat_cs_intros
        )
  qed
qed


subsubsection‹
Adjunction constructed from universal morphisms 
from objects to functors is an adjunction
›

lemma cf_adjunction_AdjNT_of_unit_is_ntcf:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
  shows "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η :
    HomO.Cα𝔇(𝔉-,-) CF HomO.Cα(-,𝔊-) :
    op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
proof-

  interpret: category α  by (rule assms(1))
  interpret 𝔇: category α 𝔇 by (rule assms(2))
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(4))
  interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 η by (rule assms(5))

  show ?thesis
  proof(intro is_ntcfI')

    show "vfsequence (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η)"
      unfolding cf_adjunction_AdjNT_of_unit_def by simp
    show "vcard (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η) = 5"
      unfolding cf_adjunction_AdjNT_of_unit_def by (simp add: nat_omega_simps)
    from assms(2,3) show 
      "HomO.Cα𝔇(𝔉-,-) : op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      by (cs_concl cs_shallow cs_intro: cat_cs_intros)
    from assms show "HomO.Cα(-,𝔊-) : op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      by (cs_concl cs_shallow cs_intro: cat_cs_intros)
    show "vsv (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap)" 
      by (intro adj_cs_intros)
    from assms show 
      "𝒟 (cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMap) = (op_cat  ×C 𝔇)Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps adj_cs_simps)

    show "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMapcd :
      HomO.Cα𝔇(𝔉-,-)ObjMapcd cat_Set αHomO.Cα(-,𝔊-)ObjMapcd"
      if "cd  (op_cat  ×C 𝔇)Obj" for cd
    proof-
      from that obtain c d 
        where cd_def: "cd = [c, d]" and c: "c  Obj" and d: "d  𝔇Obj"
        by 
          (
            auto 
              simp: cat_op_simps 
              elim: cat_prod_2_ObjE[OF ℭ.category_op 𝔇.category_axioms]
          )
      from assms c d show ?thesis
        unfolding cd_def
        by 
          (
            cs_concl cs_shallow
              cs_simp: adj_cs_simps cat_cs_simps cat_op_simps 
              cs_intro: cat_cs_intros cat_op_intros cat_prod_cs_intros
          )
    qed

    show 
      "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMapc'd' Acat_Set αHomO.Cα𝔇(𝔉-,-)ArrMapgf =
          HomO.Cα(-,𝔊-)ArrMapgf Acat_Set αcf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηNTMapcd"
      if "gf : cd op_cat  ×C 𝔇c'd'" for cd c'd' gf 
    proof-
      from that obtain g f c c' d d'
        where gf_def: "gf = [g, f]"
          and cd_def: "cd = [c, d]"
          and c'd'_def: "c'd' = [c', d']"
          and g: "g : c' c" 
          and f: "f : d 𝔇d'"
        by 
          (
            auto 
              simp: cat_op_simps 
              elim: cat_prod_2_is_arrE[OF ℭ.category_op 𝔇.category_axioms]
          ) 
      from assms g f that show ?thesis
        unfolding gf_def cd_def c'd'_def
        by 
          (
            cs_concl 
              cs_simp: cf_umap_of_cf_hom_unit_commute adj_cs_simps cat_cs_simps
              cs_intro: cat_cs_intros cat_op_intros cat_prod_cs_intros
          )
    qed

  qed (auto simp: cf_adjunction_AdjNT_of_unit_components cat_cs_simps)

qed

lemma cf_adjunction_AdjNT_of_unit_is_ntcf'[adj_cs_intros]:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
    and "𝔖 = HomO.Cα𝔇(𝔉-,-)"
    and "𝔖' = HomO.Cα(-,𝔊-)"
    and "𝔄 = op_cat  ×C 𝔇"
    and "𝔅 = cat_Set α"
  shows "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η : 𝔖 CF 𝔖' : 𝔄 ↦↦Cα𝔅"
  using assms(1-5) unfolding assms(6-9) 
  by (rule cf_adjunction_AdjNT_of_unit_is_ntcf)


subsubsection‹
Adjunction constructed from universal morphisms from objects to functors
›

definition cf_adjunction_of_unit :: "V  V  V  V  V"
  where "cf_adjunction_of_unit α 𝔉 𝔊 η =
    [𝔉, 𝔊, cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η]"


text‹Components.›

lemma cf_adjunction_of_unit_components:
  shows [adj_cs_simps]: "cf_adjunction_of_unit α 𝔉 𝔊 ηAdjLeft = 𝔉"
    and [adj_cs_simps]: "cf_adjunction_of_unit α 𝔉 𝔊 ηAdjRight = 𝔊"
    and "cf_adjunction_of_unit α 𝔉 𝔊 ηAdjNT =
      cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η"
  unfolding cf_adjunction_of_unit_def adj_field_simps
  by (simp_all add: nat_omega_simps)


text‹Natural transformation map.›

lemma cf_adjunction_of_unit_AdjNT_NTMap_vdomain[adj_cs_simps]:
  assumes "𝔉 :  ↦↦Cα𝔇"
  shows "𝒟 (cf_adjunction_of_unit α 𝔉 𝔊 ηAdjNTNTMap) = 
    (op_cat  ×C 𝔇)Obj"
  using assms 
  unfolding cf_adjunction_of_unit_components(3)
  by (rule cf_adjunction_AdjNT_of_unit_NTMap_vdomain)

lemma cf_adjunction_of_unit_AdjNT_NTMap_app[adj_cs_simps]:
  assumes "𝔉 :  ↦↦Cα𝔇" and "c  Obj" and "d  𝔇Obj"
  shows 
    "cf_adjunction_of_unit α 𝔉 𝔊 ηAdjNTNTMapc, d =
      umap_of 𝔊 c (𝔉ObjMapc) (ηNTMapc) d"
  using assms 
  unfolding cf_adjunction_of_unit_components(3)
  by (rule cf_adjunction_AdjNT_of_unit_NTMap_app)


text‹
The adjunction constructed from universal morphisms from objects to 
functors is an adjunction.
›

lemma cf_adjunction_of_unit_is_cf_adjunction:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
    and "x. x  Obj  universal_arrow_of 𝔊 x (𝔉ObjMapx) (ηNTMapx)"
  shows "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
proof-

  interpret: category α  by (rule assms(1))
  interpret 𝔇: category α 𝔇 by (rule assms(2))
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(4))
  interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 η by (rule assms(5))

  show caou_η: "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
  proof
    (
      intro 
        is_cf_adjunctionI[OF _ _ assms(1-4)] 
        is_iso_ntcf_if_bnt_proj_snd_is_iso_ntcf[
          OF ℭ.category_op 𝔇.category_axioms
          ],
      unfold cat_op_simps cf_adjunction_of_unit_components
    )
    show caou_η: "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 η :
      HomO.Cα𝔇(𝔉-,-) CF HomO.Cα(-,𝔊-) :
      op_cat  ×C 𝔇 ↦↦Cαcat_Set α"
      unfolding cf_adjunction_of_unit_components
      by (rule cf_adjunction_AdjNT_of_unit_is_ntcf[OF assms(1-5)])
    fix a assume prems: "a  Obj"
    have ua_of_ηa:
      "ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa) :
        HomO.Cα𝔇(𝔉ObjMapa,-) CF.iso HomO.Cα(a,-) CF 𝔊 :
        𝔇 ↦↦Cαcat_Set α"
      by 
        (
          rule is_functor.cf_ntcf_ua_of_is_iso_ntcf[
            OF assms(4) assms(6)[OF prems]
            ]
        )
    have [adj_cs_simps]:
      "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF =
        ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa)"
    proof(rule ntcf_eqI)
      from assms(1-5) caou_η prems show lhs: 
        "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF :
          HomO.Cα𝔇(𝔉ObjMapa,-) CF HomO.Cα(a,-) CF 𝔊 :
          𝔇 ↦↦Cαcat_Set α"
        by 
          (
            cs_concl cs_shallow
              cs_simp: cat_cs_simps cat_op_simps 
              cs_intro: cat_cs_intros cat_op_intros
          )
      from ua_of_ηa show rhs:
        "ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa) :
          HomO.Cα𝔇(𝔉ObjMapa,-) CF HomO.Cα(a,-) CF 𝔊 :
          𝔇 ↦↦Cαcat_Set α"
        by (cs_concl cs_shallow cs_intro: ntcf_cs_intros)
      from lhs have dom_lhs:
        "𝒟 ((cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF)NTMap) =
          𝔇Obj"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps)
      from lhs assms(4) have dom_rhs:
        "𝒟 (ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa)NTMap) = 𝔇Obj"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps)
      show 
        "(cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF)NTMap =
          ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa)NTMap"
      proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
        fix d assume prems': "d  𝔇Obj"
        from assms(3,4) prems prems' show 
          "(cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF)NTMapd =
            ntcf_ua_of α 𝔊 a (𝔉ObjMapa) (ηNTMapa)NTMapd"
          by (cs_concl cs_shallow cs_simp: adj_cs_simps cat_cs_simps)
      qed (simp_all add: bnt_proj_snd_NTMap_vsv 𝔊.ntcf_ua_of_NTMap_vsv)
    qed simp_all
    from assms(1-5) assms(6)[OF prems] prems show 
      "cf_adjunction_AdjNT_of_unit α 𝔉 𝔊 ηop_cat ,𝔇(a,-)NTCF :
        HomO.Cα𝔇(𝔉-,-)op_cat ,𝔇(a,-)CF CF.iso
        HomO.Cα(-,𝔊-)op_cat ,𝔇(a,-)CF :
        𝔇 ↦↦Cαcat_Set α"
      by 
        (
          cs_concl cs_shallow 
            cs_simp: adj_cs_simps cat_cs_simps cs_intro: cat_cs_intros
        )
  qed (auto simp: cf_adjunction_of_unit_def nat_omega_simps)

  show "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
  proof(rule ntcf_eqI)
    from caou_η show lhs:
      "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) :
        cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
      by (cs_concl cs_shallow cs_intro: adj_cs_intros)
    show rhs: "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
      by (auto intro: cat_cs_intros)
    from lhs have dom_lhs:
      "𝒟 (ηC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMap) = Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps)
    have dom_rhs: "𝒟 (ηNTMap) = Obj" by (auto simp: cat_cs_simps)
    show "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMap = ηNTMap"
    proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
      fix a assume prems: "a  Obj"
      from assms(1-5) prems caou_η show 
        "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMapa = ηNTMapa"
        by 
          (
            cs_concl cs_shallow
              cs_simp: 
                adj_cs_simps cat_cs_simps cf_adjunction_of_unit_components(3) 
              cs_intro: cat_cs_intros
          )
    qed (auto intro: adj_cs_intros)
  qed simp_all

qed



subsection‹
Construction of an adjunction from a functor and universal morphisms 
from objects to functors
›


text‹
The subsection presents the construction of an adjunction given 
a functor and a structured collection of universal morphisms 
from objects to functors.
The content of this subsection follows the statement and the proof
of Theorem 2-ii in Chapter IV-1 in cite"mac_lane_categories_2010".
›


subsubsection‹Left adjoint›

definition cf_la_of_ra :: "(V  V)  V  V  V"
  where "cf_la_of_ra F 𝔊 η =
    [
      (λx𝔊HomCodObj. F x),
      (
        λh𝔊HomCodArr. THE f'.
          f' : F (𝔊HomCodDomh) 𝔊HomDomF (𝔊HomCodCodh) 
            η𝔊HomCodCodh A𝔊HomCodh =
              (
                umap_of
                  𝔊
                  (𝔊HomCodDomh)
                  (F (𝔊HomCodDomh))
                  (η𝔊HomCodDomh)
                  (F (𝔊HomCodCodh))
              )ArrValf'
      ),
      𝔊HomCod,
      𝔊HomDom
    ]"


text‹Components.›

lemma cf_la_of_ra_components:
  shows "cf_la_of_ra F 𝔊 ηObjMap = (λx𝔊HomCodObj. F x)"
    and "cf_la_of_ra F 𝔊 ηArrMap =
      (
        λh𝔊HomCodArr. THE f'.
          f' : F (𝔊HomCodDomh) 𝔊HomDomF (𝔊HomCodCodh) 
          η𝔊HomCodCodh A𝔊HomCodh =
            (
              umap_of
                𝔊 
                (𝔊HomCodDomh)
                (F (𝔊HomCodDomh))
                (η𝔊HomCodDomh)
                (F (𝔊HomCodCodh))
            )ArrValf'
      )"
    and "cf_la_of_ra F 𝔊 ηHomDom = 𝔊HomCod"
    and "cf_la_of_ra F 𝔊 ηHomCod = 𝔊HomDom"
  unfolding cf_la_of_ra_def dghm_field_simps by (simp_all add: nat_omega_simps)


subsubsection‹Object map›

mk_VLambda cf_la_of_ra_components(1)
  |vsv cf_la_of_ra_ObjMap_vsv[adj_cs_intros]|

mk_VLambda (in is_functor) 
  cf_la_of_ra_components(1)[where ?𝔊=𝔉, unfolded cf_HomCod]
  |vdomain cf_la_of_ra_ObjMap_vdomain[adj_cs_simps]|
  |app cf_la_of_ra_ObjMap_app[adj_cs_simps]|

lemmas [adj_cs_simps] =
  is_functor.cf_la_of_ra_ObjMap_vdomain
  is_functor.cf_la_of_ra_ObjMap_app
  

subsubsection‹Arrow map›

mk_VLambda cf_la_of_ra_components(2)
  |vsv cf_la_of_ra_ArrMap_vsv[adj_cs_intros]|

mk_VLambda (in is_functor) 
  cf_la_of_ra_components(2)[where ?𝔊=𝔉, unfolded cf_HomCod cf_HomDom]
  |vdomain cf_la_of_ra_ArrMap_vdomain[adj_cs_simps]|
  |app cf_la_of_ra_ArrMap_app| (*not for general use*)

lemmas [adj_cs_simps] = is_functor.cf_la_of_ra_ArrMap_vdomain

lemma (in is_functor) cf_la_of_ra_ArrMap_app':
  assumes "h : a 𝔅b"
  shows 
    "cf_la_of_ra F 𝔉 ηArrMaph =
      (
        THE f'.
          f' : F a 𝔄F b 
          ηb A𝔅h = umap_of 𝔉 a (F a) (ηa) (F b)ArrValf'
      )"
proof-
  from assms have h: "h  𝔅Arr" by (simp add: cat_cs_intros)
  from assms have h_Dom: "𝔅Domh = a" and h_Cod: "𝔅Codh = b"
    by (simp_all add: cat_cs_simps)
  show ?thesis by (rule cf_la_of_ra_ArrMap_app[OF h, unfolded h_Dom h_Cod])
qed

lemma cf_la_of_ra_ArrMap_app_unique:
  assumes "𝔊 : 𝔇 ↦↦Cα"
    and "f : a b"
    and "universal_arrow_of 𝔊 a (cf_la_of_ra F 𝔊 ηObjMapa) (ηa)"
    and "universal_arrow_of 𝔊 b (cf_la_of_ra F 𝔊 ηObjMapb) (ηb)"
  shows "cf_la_of_ra F 𝔊 ηArrMapf : F a 𝔇F b"
    and "ηb Af = 
      umap_of 𝔊 a (F a) (ηa) (F b)ArrValcf_la_of_ra F 𝔊 ηArrMapf"
    and "f'.
      
        f' : F a 𝔇F b;
        ηb Af = umap_of 𝔊 a (F a) (ηa) (F b)ArrValf'
        cf_la_of_ra F 𝔊 ηArrMapf = f'"
proof-

  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(1))

  from assms(2) have a: "a  Obj" and b: "b  Obj" 
    by (simp_all add: cat_cs_intros)
  note ua_η_a = 𝔊.universal_arrow_ofD[OF assms(3)]
  note ua_η_b = 𝔊.universal_arrow_ofD[OF assms(4)]
  from ua_η_b(2) have [cat_cs_intros]: 
    " c = b; c' = 𝔊ObjMapcf_la_of_ra F 𝔊 ηObjMapb   ηb : c c'"
    for c c'
    by auto
  from assms(1,2) ua_η_a(2) have ηa_f:
    "ηb Af : a 𝔊ObjMapcf_la_of_ra F 𝔊 ηObjMapb"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
  from assms(1,2) have lara_a: "cf_la_of_ra F 𝔊 ηObjMapa = F a"
    and lara_b: "cf_la_of_ra F 𝔊 ηObjMapb = F b"
    by (cs_concl cs_simp: adj_cs_simps cs_intro: cat_cs_intros)+

  from theD
    [
      OF 
        ua_η_a(3)[OF ua_η_b(1) ηa_f, unfolded lara_a lara_b] 
        𝔊.cf_la_of_ra_ArrMap_app'[OF assms(2), of F η]
    ]
  show "cf_la_of_ra F 𝔊 ηArrMapf : F a 𝔇F b"
    and "ηb Af = umap_of
      𝔊 a (F a) (ηa) (F b)ArrValcf_la_of_ra F 𝔊 ηArrMapf"
    and "f'.
      
        f' : F a 𝔇F b;
        ηb Af = umap_of 𝔊 a (F a) (ηa) (F b)ArrValf'
        cf_la_of_ra F 𝔊 ηArrMapf = f'"
    by blast+

qed

lemma cf_la_of_ra_ArrMap_app_is_arr[adj_cs_intros]:
  assumes "𝔊 : 𝔇 ↦↦Cα"
    and "f : a b"
    and "universal_arrow_of 𝔊 a (cf_la_of_ra F 𝔊 ηObjMapa) (ηa)"
    and "universal_arrow_of 𝔊 b (cf_la_of_ra F 𝔊 ηObjMapb) (ηb)"
    and "Fa = F a"
    and "Fb = F b"
  shows "cf_la_of_ra F 𝔊 ηArrMapf : Fa 𝔇Fb"
  using assms(1-4) unfolding assms(5,6) by (rule cf_la_of_ra_ArrMap_app_unique)


subsubsection‹
An adjunction constructed from a functor and universal morphisms 
from objects to functors is an adjunction
›

lemma cf_la_of_ra_is_functor:
  assumes "𝔊 : 𝔇 ↦↦Cα"
    and "c. c  Obj  F c  𝔇Obj"
    and "c. c  Obj 
      universal_arrow_of 𝔊 c (cf_la_of_ra F 𝔊 ηObjMapc) (ηc)"
    and "c c' h. h : c c' 
      𝔊ArrMapcf_la_of_ra F 𝔊 ηArrMaph Aηc = ηc' Ah"
  shows "cf_la_of_ra F 𝔊 η :  ↦↦Cα𝔇" (is ?𝔉 :  ↦↦Cα𝔇)
proof-

  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(1))

  show "cf_la_of_ra F 𝔊 η :  ↦↦Cα𝔇"
  proof(rule is_functorI')

    show "vfsequence ?𝔉" unfolding cf_la_of_ra_def by auto
    show "vcard ?𝔉 = 4" 
      unfolding cf_la_of_ra_def by (simp add: nat_omega_simps)
    show " (?𝔉ObjMap)  𝔇Obj"
    proof(rule vsv.vsv_vrange_vsubset, unfold 𝔊.cf_la_of_ra_ObjMap_vdomain)
      fix x assume "x  Obj"
      with assms(1) show "?𝔉ObjMapx  𝔇Obj"
        by (cs_concl cs_shallow cs_simp: adj_cs_simps cs_intro: assms(2))
    qed (auto intro: adj_cs_intros)

    show "?𝔉ArrMapf : ?𝔉ObjMapa 𝔇?𝔉ObjMapb"
      if "f : a b" for a b f
    proof-
      from that have a: "a  Obj" and b: "b  Obj" 
        by (simp_all add: cat_cs_intros)
      have ua_η_a: "universal_arrow_of 𝔊 a (?𝔉ObjMapa) (ηa)"
        and ua_η_b: "universal_arrow_of 𝔊 b (?𝔉ObjMapb) (ηb)"
        by (intro assms(3)[OF a] assms(3)[OF b])+
      from a b cf_la_of_ra_ArrMap_app_unique(1)[OF assms(1) that ua_η_a ua_η_b] 
      show ?thesis 
        by (cs_concl cs_shallow cs_simp: adj_cs_simps)
    qed

    show "?𝔉ArrMapg Af = ?𝔉ArrMapg A𝔇?𝔉ArrMapf"
      if "g : b c" and "f : a b" for b c g a f
    proof-

      from that have a: "a  Obj" and b: "b  Obj" and c: "c  Obj" 
        by (simp_all add: cat_cs_intros)
      from assms(1) that have gf: "g Af : a c"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)

      note ua_η_a = assms(3)[OF a]
        and ua_η_b = assms(3)[OF b]
        and ua_η_c = assms(3)[OF c]

      note lara_f = 
        cf_la_of_ra_ArrMap_app_unique[OF assms(1) that(2) ua_η_a ua_η_b]
      note lara_g = 
        cf_la_of_ra_ArrMap_app_unique[OF assms(1) that(1) ua_η_b ua_η_c]
      note lara_gf = 
        cf_la_of_ra_ArrMap_app_unique[OF assms(1) gf ua_η_a ua_η_c]

      note ua_η_a = 𝔊.universal_arrow_ofD[OF ua_η_a]
        and ua_η_b = 𝔊.universal_arrow_ofD[OF ua_η_b]
        and ua_η_c = 𝔊.universal_arrow_ofD[OF ua_η_c]
      
      from ua_η_a(2) assms(1) that have ηa: 
        "ηa : a 𝔊ObjMapF a"
        by (cs_prems cs_simp: adj_cs_simps cs_intro: cat_cs_intros)
      from ua_η_b(2) assms(1) that have ηb: 
        "ηb : b 𝔊ObjMapF b"
        by (cs_prems cs_shallow cs_simp: adj_cs_simps cs_intro: cat_cs_intros)
      from ua_η_c(2) assms(1) that have ηc: 
        "ηc : c 𝔊ObjMapF c"
        by (cs_prems cs_shallow cs_simp: adj_cs_simps cs_intro: cat_cs_intros)

      from assms(1) that ηc have
        "ηc A(g Af) = (ηc Ag) Af"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      also from assms(1) lara_g(1) that(2) ηb have 
        " = 𝔊ArrMap?𝔉ArrMapg A(ηb Af)"
        by 
          (
            cs_concl 
              cs_simp: lara_g(2) cat_cs_simps 
              cs_intro: cat_cs_intros cat_prod_cs_intros
          )
      also from assms(1) lara_f(1) ηa have " =
        𝔊ArrMap?𝔉ArrMapg A(𝔊ArrMap?𝔉ArrMapf Aηa)"
        by (cs_concl cs_shallow cs_simp: lara_f(2) cat_cs_simps)
      finally have [symmetric, cat_cs_simps]: 
        "ηc A(g Af) = ".
      from assms(1) this ηa ηb ηc lara_g(1) lara_f(1) have 
        "ηc A(g Af) =
          umap_of 𝔊 a (F a) (ηa) (F c)ArrVal?𝔉ArrMapg A𝔇?𝔉ArrMapf"
        by 
          ( 
            cs_concl cs_shallow
              cs_simp: adj_cs_simps cat_cs_simps 
              cs_intro: adj_cs_intros cat_cs_intros
          )
      moreover from assms(1) lara_g(1) lara_f(1) have 
        "?𝔉ArrMapg A𝔇?𝔉ArrMapf : F a 𝔇F c"
        by (cs_concl cs_shallow cs_intro: adj_cs_intros cat_cs_intros)
      ultimately show ?thesis by (intro lara_gf(3))

    qed

    show "?𝔉ArrMapCIdc = 𝔇CId?𝔉ObjMapc" if "c  Obj" for c 
    proof-
      note lara_c = cf_la_of_ra_ArrMap_app_unique[
          OF 
            assms(1) 
            𝔊.HomCod.cat_CId_is_arr[OF that] 
            assms(3)[OF that] 
            assms(3)[OF that]
          ]
      from assms(1) that have 𝔇c: "𝔇CIdF c : F c 𝔇F c "
        by (cs_concl cs_simp: cat_cs_simps cs_intro: assms(2) cat_cs_intros)
      from 𝔊.universal_arrow_ofD(2)[OF assms(3)[OF that]] assms(1) that have ηc: 
        "ηc : c 𝔊ObjMapF c"
        by (cs_prems cs_shallow cs_simp: adj_cs_simps cs_intro: cat_cs_intros)
      from assms(1) that ηc have 
        "ηc ACIdc =
          umap_of 𝔊 c (F c) (ηc) (F c)ArrVal𝔇CIdF c"
        by (cs_concl cs_simp: cat_cs_simps cs_intro: assms(2) cat_cs_intros)
      note [cat_cs_simps] = lara_c(3)[OF 𝔇c this]
      from assms(1) that 𝔇c show ?thesis
        by 
          (
            cs_concl cs_shallow 
              cs_simp: adj_cs_simps cat_cs_simps cs_intro: cat_cs_intros
          )
    qed
  qed (auto simp: cf_la_of_ra_components cat_cs_intros cat_cs_simps)

qed

lemma cf_la_of_ra_is_ntcf:  
  fixes F  𝔉 𝔊 ηm η
  defines "𝔉  cf_la_of_ra F 𝔊 ηm"
    and "η  [ηm, cf_id , 𝔊 CF 𝔉, , ]"
  assumes "𝔊 : 𝔇 ↦↦Cα"
    and "c. c  Obj  F c  𝔇Obj"
    and "c. c  Obj  universal_arrow_of 𝔊 c (𝔉ObjMapc) (ηNTMapc)"
    and "c c' h. h : c c' 
      𝔊ArrMap𝔉ArrMaph A(ηNTMapc) = (ηNTMapc') Ah"
    and "vsv (ηNTMap)"
    and "𝒟 (ηNTMap) = Obj"
  shows "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
proof-
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(3))
  have η_components: 
    "ηNTMap = ηm"
    "ηNTDom = cf_id "
    "ηNTCod = 𝔊 CF 𝔉"
    "ηNTDGDom = "
    "ηNTDGCod = "
    unfolding η_def nt_field_simps by (simp_all add: nat_omega_simps)
  note 𝔉_def = 𝔉_def[folded η_components(1)]
  have 𝔉: "𝔉 :  ↦↦Cα𝔇"
    unfolding 𝔉_def
    by (auto intro: cf_la_of_ra_is_functor[OF assms(3-6)[unfolded 𝔉_def]])
  show "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
  proof(rule is_ntcfI')
    show "vfsequence η" unfolding η_def by simp
    show "vcard η = 5" unfolding η_def by (simp_all add: nat_omega_simps)
    from assms(2) show "cf_id  :  ↦↦Cα"
      by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
    from assms(2) 𝔉 show "𝔊 CF 𝔉 :  ↦↦Cα"
      by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
    show "ηNTMapa : cf_id ObjMapa (𝔊 CF 𝔉)ObjMapa"
      if "a  Obj" for a
      using assms(2) 𝔉 that 𝔊.universal_arrow_ofD(2)[OF assms(5)[OF that]]
      by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
    show 
      "ηNTMapb Acf_id ArrMapf =
        (𝔊 CF 𝔉)ArrMapf AηNTMapa"
      if "f : a b" for a b f
      using assms(3) 𝔉 that 
      by 
        (
          cs_concl cs_shallow 
            cs_simp: assms(6) cat_cs_simps cs_intro: cat_cs_intros
        )
  qed (auto simp: η_components(2-5) assms(7-8))
qed

lemma cf_la_of_ra_is_unit:  
  fixes F  𝔉 𝔊 ηm η
  defines "𝔉  cf_la_of_ra F 𝔊 ηm"
    and "η  [ηm, cf_id , 𝔊 CF 𝔉, , ]"
  assumes "category α "
    and "category α 𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "c. c  Obj  F c  𝔇Obj"
    and "c. c  Obj 
      universal_arrow_of 𝔊 c (𝔉ObjMapc) (ηNTMapc)"
    and "c c' h. h : c c' 
      𝔊ArrMap𝔉ArrMaph A(ηNTMapc) = (ηNTMapc') Ah"
    and "vsv (ηNTMap)"
    and "𝒟 (ηNTMap) = Obj"
  shows "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
proof-
  have η_components: 
    "ηNTMap = ηm"
    "ηNTDom = cf_id "
    "ηNTCod = 𝔊 CF 𝔉"
    "ηNTDGDom = "
    "ηNTDGCod = "
    unfolding η_def nt_field_simps by (simp_all add: nat_omega_simps)
  note 𝔉_def = 𝔉_def[folded η_components(1)]
  note 𝔉 = cf_la_of_ra_is_functor
    [
      where F=F and= and 𝔊=𝔊 and η=ηm, 
      folded 𝔉_def[unfolded η_components(1)], 
      folded η_components(1),
      OF assms(5-8),
      simplified
    ]
  note η = cf_la_of_ra_is_ntcf
    [
      where F=F and= and 𝔊=𝔊 and ηm=ηm, 
      folded 𝔉_def[unfolded η_components(1)], 
      folded η_def, 
      OF assms(5-10),
      simplified
    ]
  show "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
    by 
      (
        intro cf_adjunction_of_unit_is_cf_adjunction[
          OF assms(3,4) 𝔉 assms(5) η assms(7), simplified, folded 𝔉_def
          ]
      )+
qed



subsection‹
Construction of an adjunction from universal morphisms 
from functors to objects
›


subsubsection‹Definition and elementary properties›


text‹
The subsection presents the construction of an adjunction given 
a structured collection of universal morphisms from functors to objects.
The content of this subsection follows the statement and the proof
of Theorem 2-iii in Chapter IV-1 in cite"mac_lane_categories_2010".
›

definition cf_adjunction_of_counit :: "V  V  V  V  V"
  where "cf_adjunction_of_counit α 𝔉 𝔊 ε =
    op_cf_adj (cf_adjunction_of_unit α (op_cf 𝔊) (op_cf 𝔉) (op_ntcf ε))"


text‹Components.›

lemma cf_adjunction_of_counit_components:
  shows "cf_adjunction_of_counit α 𝔉 𝔊 εAdjLeft = op_cf (op_cf 𝔉)"
    and "cf_adjunction_of_counit α 𝔉 𝔊 εAdjRight = op_cf (op_cf 𝔊)"
    and "cf_adjunction_of_counit α 𝔉 𝔊 εAdjNT = op_cf_adj_nt
      (op_cf 𝔊HomDom)
      (op_cf 𝔊HomCod)
      (cf_adjunction_AdjNT_of_unit α (op_cf 𝔊) (op_cf 𝔉) (op_ntcf ε))"
  unfolding 
    cf_adjunction_of_counit_def 
    op_cf_adj_components 
    cf_adjunction_of_unit_components
  by (simp_all add: cat_op_simps)


subsubsection‹Natural transformation map›

lemma cf_adjunction_of_counit_NTMap_vsv: 
  "vsv (cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMap)"
  unfolding cf_adjunction_of_counit_components by (rule inv_ntcf_NTMap_vsv)
  


subsubsection‹
An adjunction constructed from universal morphisms 
from functors to objects is an adjunction
›

lemma cf_adjunction_of_counit_is_cf_adjunction:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "ε : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
    and "x. x  𝔇Obj  universal_arrow_fo 𝔉 x (𝔊ObjMapx) (εNTMapx)"
  shows "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
    and "𝒟 (cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMap) = 
      (op_cat  ×C 𝔇)Obj"
    and "c d.  c  Obj; d  𝔇Obj  
      cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMapc, d =
        (umap_fo 𝔉 d (𝔊ObjMapd) (εNTMapd) c)¯Set"
proof-

  interpret: category α  by (rule assms(1))
  interpret 𝔇: category α 𝔇 by (rule assms(2))
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(4))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 ε by (rule assms(5))
  
  note cf_adjunction_of_counit_def' = 
    cf_adjunction_of_counit_def[where 𝔉=𝔉, unfolded 𝔉.cf_HomDom 𝔉.cf_HomCod]
  
  have ua:
    "universal_arrow_of (op_cf 𝔉) x (op_cf 𝔊ObjMapx) (op_ntcf εNTMapx)"
    if "x  op_cat 𝔇Obj" for x
    using that unfolding cat_op_simps by (rule assms(6))
  
  let ?aou = cf_adjunction_of_unit α (op_cf 𝔊) (op_cf 𝔉) (op_ntcf ε)
  from 
    cf_adjunction_of_unit_is_cf_adjunction
      [
        OF 
          𝔇.category_op
          ℭ.category_op
          𝔊.is_functor_op
          𝔉.is_functor_op
          ε.is_ntcf_op[unfolded cat_op_simps]
          ua,
        simplified cf_adjunction_of_counit_def[symmetric]
      ]
  have aou: "?aou : op_cf 𝔊 CF op_cf 𝔉 : op_cat 𝔇 ⇌⇌Cαop_cat "
    and η_aou: "ηC ?aou = op_ntcf ε"
    by auto
  interpret aou: 
    is_cf_adjunction α op_cat 𝔇 op_cat  op_cf 𝔊 op_cf 𝔉 ?aou
    by (rule aou)
  from η_aou have
    "op_ntcf (ηC ?aou) = op_ntcf (op_ntcf ε)"
    by simp
  then show "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
    unfolding 
      ε.ntcf_op_ntcf_op_ntcf
      is_cf_adjunction.op_ntcf_cf_adjunction_unit[OF aou]
      cf_adjunction_of_counit_def'[symmetric]
    by (simp add: cat_op_simps)
  show aoc_ε: "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    by 
      (
        rule 
          is_cf_adjunction_op[
            OF aou, folded cf_adjunction_of_counit_def', unfolded cat_op_simps
          ]
      )
  interpret aoc_ε: is_cf_adjunction α  𝔇 𝔉 𝔊 cf_adjunction_of_counit α 𝔉 𝔊 ε
    by (rule aoc_ε)

  from aoc_ε.NT.is_ntcf_axioms show
    "𝒟 (cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMap) = (op_cat  ×C 𝔇)Obj"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps)

  show "c d.  c  Obj; d  𝔇Obj  
    cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMapc, d =
      (umap_fo 𝔉 d (𝔊ObjMapd) (εNTMapd) c)¯Set"
  proof-
    fix c d assume prems: "c  Obj" "d  𝔇Obj"
    from assms(1-4) prems have aou_dc:
      "cf_adjunction_AdjNT_of_unit 
        α (op_cf 𝔊) (op_cf 𝔉) (op_ntcf ε)NTMapd, c =
        umap_fo 𝔉 d (𝔊ObjMapd) (εNTMapd) c"
      by 
        (
          cs_concl cs_shallow 
            cs_simp: cat_op_simps adj_cs_simps cs_intro: cat_op_intros
        )
    from assms(1-4) aou prems have ufo_ε_dc:
      "umap_fo 𝔉 d (𝔊ObjMapd) (εNTMapd) c :
        HomO.Cαop_cat (op_cf 𝔊-,-)ObjMapd, c isocat_Set αHomO.Cαop_cat 𝔇(-,op_cf 𝔉-)ObjMapd, c"
      by 
        (
          cs_concl cs_shallow
            cs_simp: 
              aou_dc[symmetric] cf_adjunction_of_unit_components(3)[symmetric]
            cs_intro: 
              is_iso_ntcf.iso_ntcf_is_iso_arr' 
              adj_cs_intros 
              cat_cs_intros 
              cat_op_intros
              cat_prod_cs_intros
        )
    from 
      assms(1-4) 
      aoc_ε[unfolded cf_adjunction_of_counit_def'] 
      aou 
      prems 
      ufo_ε_dc
    show
      "cf_adjunction_of_counit α 𝔉 𝔊 εAdjNTNTMapc, d =
        (umap_fo 𝔉 d (𝔊ObjMapd) (εNTMapd) c)¯Set"
      unfolding cf_adjunction_of_counit_def'
      by 
        ( 
          cs_concl
            cs_simp: cat_op_simps adj_cs_simps cat_cs_simps cat_Set_cs_simps 
            cs_intro: adj_cs_intros cat_cs_intros cat_prod_cs_intros
        )
  qed

qed



subsection‹
Construction of an adjunction from a functor and universal morphisms
from functors to objects
›


text‹
The subsection presents the construction of an adjunction given 
a functor and a structured collection of universal morphisms 
from functors to objects.
The content of this subsection follows the statement and the proof
of Theorem 2-iv in Chapter IV-1 in cite"mac_lane_categories_2010".
›


subsubsection‹Definition and elementary properties›

definition cf_ra_of_la :: "(V  V)  V  V  V"
  where "cf_ra_of_la F 𝔉 ε = op_cf (cf_la_of_ra F (op_cf 𝔉) ε)"


subsubsection‹Object map›

lemma cf_ra_of_la_ObjMap_vsv[adj_cs_intros]: "vsv (cf_ra_of_la F 𝔉 εObjMap)"
  unfolding cf_ra_of_la_def op_cf_components by (auto intro: adj_cs_intros)

lemma (in is_functor) cf_ra_of_la_ObjMap_vdomain: 
  "𝒟 (cf_ra_of_la F 𝔉 εObjMap) = 𝔅Obj"
  unfolding cf_ra_of_la_def cf_la_of_ra_components cat_op_simps 
  by (simp add: cat_cs_simps)

lemmas [adj_cs_simps] = is_functor.cf_ra_of_la_ObjMap_vdomain

lemma (in is_functor) cf_ra_of_la_ObjMap_app: 
  assumes "d  𝔅Obj"
  shows "cf_ra_of_la F 𝔉 εObjMapd = F d"
  using assms 
  unfolding cf_ra_of_la_def cf_la_of_ra_components cat_op_simps
  by (simp add: cat_cs_simps)

lemmas [adj_cs_simps] = is_functor.cf_ra_of_la_ObjMap_app


subsubsection‹Arrow map›

lemma cf_ra_of_la_ArrMap_app_unique:
  assumes "𝔉 :  ↦↦Cα𝔇"
    and "f : a 𝔇b"
    and "universal_arrow_fo 𝔉 a (cf_ra_of_la F 𝔉 εObjMapa) (εa)"
    and "universal_arrow_fo 𝔉 b (cf_ra_of_la F 𝔉 εObjMapb) (εb)"
  shows "cf_ra_of_la F 𝔉 εArrMapf : F a F b"
    and "f A𝔇εa =
      umap_fo 𝔉 b (F b) (εb) (F a)ArrValcf_ra_of_la F 𝔉 εArrMapf"
    and "f'.
      
        f' : F a F b;
        f A𝔇εa = umap_fo 𝔉 b (F b) (εb) (F a)ArrValf'
        cf_ra_of_la F 𝔉 εArrMapf = f'"
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(1))
  from assms(2) have op_f: "f : b op_cat 𝔇a" unfolding cat_op_simps by simp
  let ?lara = cf_la_of_ra F (op_cf 𝔉) ε
  have lara_ObjMap_eq_op: "?laraObjMap = (op_cf ?laraObjMap)"
    and lara_ArrMap_eq_op: "?laraArrMap = (op_cf ?laraArrMap)"
    unfolding cat_op_simps by simp_all
  note ua_η_a = 𝔉.universal_arrow_foD[OF assms(3)]
    and ua_η_b = 𝔉.universal_arrow_foD[OF assms(4)]
  from assms(1,2) ua_η_a(2) have [cat_op_simps]:
    "εa Aop_cat 𝔇f = f A𝔇εa"
    by (cs_concl cs_shallow cs_simp: cat_cs_simps cat_op_simps)
  show "cf_ra_of_la F 𝔉 εArrMapf : F a F b"
    and "f A𝔇εa =
      umap_fo 𝔉 b (F b) (εb) (F a)ArrValcf_ra_of_la F 𝔉 εArrMapf"
    and "f'.
      
        f' : F a F b;
        f A𝔇εa = umap_fo 𝔉 b (F b) (εb) (F a)ArrValf'
        cf_ra_of_la F 𝔉 εArrMapf = f'"
    by 
      (
        intro 
          cf_la_of_ra_ArrMap_app_unique
            [
              where η=ε and F=F,
                OF 𝔉.is_functor_op op_f, 
                unfolded 
                  𝔉.op_cf_universal_arrow_of 
                  lara_ObjMap_eq_op
                  lara_ArrMap_eq_op,
                folded cf_ra_of_la_def,
                unfolded cat_op_simps, OF assms(4,3)
            ]
      )+
qed

lemma cf_ra_of_la_ArrMap_app_is_arr[adj_cs_intros]:
  assumes "𝔉 :  ↦↦Cα𝔇"
    and "f : a 𝔇b"
    and "universal_arrow_fo 𝔉 a (cf_ra_of_la F 𝔉 εObjMapa) (εa)"
    and "universal_arrow_fo 𝔉 b (cf_ra_of_la F 𝔉 εObjMapb) (εb)"
    and "Fa = F a"
    and "Fb = F b"
  shows "cf_ra_of_la F 𝔉 εArrMapf : Fa Fb"
  using assms(1-4) unfolding assms(5,6) by (rule cf_ra_of_la_ArrMap_app_unique)


subsubsection‹
An adjunction constructed from a functor and universal morphisms 
from functors to objects is an adjunction
›

lemma op_cf_cf_la_of_ra_op[cat_op_simps]: 
  "op_cf (cf_la_of_ra F (op_cf 𝔉) ε) = cf_ra_of_la F 𝔉 ε"
  unfolding cf_ra_of_la_def by simp

lemma cf_ra_of_la_commute_op:
  assumes "𝔉 :  ↦↦Cα𝔇"
    and "d. d  𝔇Obj 
      universal_arrow_fo 𝔉 d (cf_ra_of_la F 𝔉 εObjMapd) (εd)"
    and "d d' h. h : d 𝔇d' 
      εd' A𝔇𝔉ArrMapcf_ra_of_la F 𝔉 εArrMaph =
        h A𝔇εd"
    and "h : c' 𝔇c"
  shows "𝔉ArrMapcf_ra_of_la F 𝔉 εArrMaph Aop_cat 𝔇εc =
    εc' Aop_cat 𝔇h"
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(1))
  from assms(4) have c': "c'  𝔇Obj" and c: "c  𝔇Obj" by auto
  note ua_η_c' = 𝔉.universal_arrow_foD[OF assms(2)[OF c']]
    and ua_η_c = 𝔉.universal_arrow_foD[OF assms(2)[OF c]]
  note rala_f = cf_ra_of_la_ArrMap_app_unique[
      OF assms(1) assms(4) assms(2)[OF c'] assms(2)[OF c]
      ]
  from assms(1) assms(4) ua_η_c'(2) ua_η_c(2) rala_f(1) show ?thesis
    by 
      (
        cs_concl cs_shallow
          cs_simp: assms(3) cat_op_simps adj_cs_simps cat_cs_simps 
          cs_intro: cat_cs_intros
      )
qed

lemma 
  assumes "𝔉 :  ↦↦Cα𝔇"
    and "d. d  𝔇Obj  F d  Obj"
    and "d. d  𝔇Obj 
      universal_arrow_fo 𝔉 d (cf_ra_of_la F 𝔉 εObjMapd) (εd)"
    and "d d' h. h : d 𝔇d' 
      εd' A𝔇𝔉ArrMapcf_ra_of_la F 𝔉 εArrMaph =
        h A𝔇εd"
  shows cf_ra_of_la_is_functor: "cf_ra_of_la F 𝔉 ε : 𝔇 ↦↦Cα"
    and cf_la_of_ra_op_is_functor:  
      "cf_la_of_ra F (op_cf 𝔉) ε : op_cat 𝔇 ↦↦Cαop_cat "
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(1))
  have 𝔉h_εc: 
    "𝔉ArrMapcf_ra_of_la F 𝔉 εArrMaph Aop_cat 𝔇εc =
      εc' Aop_cat 𝔇h"
    if "h : c' 𝔇c" for c c' h
  proof-
    from that have c': "c'  𝔇Obj" and c: "c  𝔇Obj" by auto
    note ua_η_c' = 𝔉.universal_arrow_foD[OF assms(3)[OF c']]
      and ua_η_c = 𝔉.universal_arrow_foD[OF assms(3)[OF c]]
    note rala_f = cf_ra_of_la_ArrMap_app_unique[
        OF assms(1) that assms(3)[OF c'] assms(3)[OF c]
        ]
    from assms(1) that ua_η_c'(2) ua_η_c(2) rala_f(1) show ?thesis
      by
        (
          cs_concl cs_shallow
            cs_simp: assms(4) cat_op_simps adj_cs_simps cat_cs_simps 
            cs_intro: cat_cs_intros
        )
  qed
  let ?lara = cf_la_of_ra F (op_cf 𝔉) ε
  have lara_ObjMap_eq_op: "?laraObjMap = (op_cf ?laraObjMap)"
    and lara_ArrMap_eq_op: "?laraArrMap = (op_cf ?laraArrMap)"
    by (simp_all add: cat_op_simps del: op_cf_cf_la_of_ra_op)
  show "cf_la_of_ra F (op_cf 𝔉) ε : op_cat 𝔇 ↦↦Cαop_cat "
    by 
      (
        intro cf_la_of_ra_is_functor
          [
            where F=F and η=ε,
            OF 𝔉.is_functor_op,
            unfolded cat_op_simps,
            OF assms(2),
            simplified,
            unfolded lara_ObjMap_eq_op lara_ArrMap_eq_op,
            folded cf_ra_of_la_def,
            OF assms(3) 𝔉h_εc, 
            simplified
         ]
      )
  from 
    is_functor.is_functor_op[
      OF this, unfolded cat_op_simps, folded cf_ra_of_la_def
      ]
  show "cf_ra_of_la F 𝔉 ε : 𝔇 ↦↦Cα".
qed

lemma cf_ra_of_la_is_ntcf:
  fixes F 𝔇 𝔉 𝔊 εm ε
  defines "𝔊  cf_ra_of_la F 𝔉 εm"
    and "ε  [εm, 𝔉 CF 𝔊, cf_id 𝔇, 𝔇, 𝔇]"
  assumes "𝔉 :  ↦↦Cα𝔇"
    and "d. d  𝔇Obj  F d  Obj"
    and "d. d  𝔇Obj 
      universal_arrow_fo 𝔉 d (𝔊ObjMapd) (εNTMapd)"
    and "d d' h. h : d 𝔇d' 
      εNTMapd' A𝔇𝔉ArrMap𝔊ArrMaph = h A𝔇εNTMapd"
    and "vsv (εNTMap)"
    and "𝒟 (εNTMap) = 𝔇Obj"
  shows "ε : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
proof-
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  have ε_components: 
    "εNTMap = εm"
    "εNTDom = 𝔉 CF 𝔊"
    "εNTCod = cf_id 𝔇"
    "εNTDGDom = 𝔇"
    "εNTDGCod = 𝔇"
    unfolding ε_def nt_field_simps by (simp_all add: nat_omega_simps)
  note 𝔊_def = 𝔊_def[folded ε_components(1)]
  interpret 𝔊: is_functor α 𝔇  𝔊 
    unfolding 𝔊_def
    by (auto intro: cf_ra_of_la_is_functor[OF assms(3-6)[unfolded 𝔊_def]])
  interpret op_ε: is_functor 
    α op_cat 𝔇 op_cat  cf_la_of_ra F (op_cf 𝔉) (εNTMap)
    by 
      (
        intro cf_la_of_ra_op_is_functor[
          where F=F and ε=εNTMap, OF assms(3-6)[unfolded 𝔊_def], simplified
          ]
      )
  interpret ε: vfsequence ε unfolding ε_def by simp
  have [cat_op_simps]: "op_ntcf (op_ntcf ε) = ε"
  proof(rule vsv_eqI)
    have dom_lhs: "𝒟 (op_ntcf (op_ntcf ε)) = 5"
      unfolding op_ntcf_def by (simp add: nat_omega_simps)
    from assms(7) show "𝒟 (op_ntcf (op_ntcf ε)) = 𝒟 ε" 
      unfolding dom_lhs by (simp add: ε_def ε.vfsequence_vdomain nat_omega_simps)
    have sup: 
      "op_ntcf (op_ntcf ε)NTDom = εNTDom" 
      "op_ntcf (op_ntcf ε)NTCod = εNTCod" 
      "op_ntcf (op_ntcf ε)NTDGDom = εNTDGDom" 
      "op_ntcf (op_ntcf ε)NTDGCod = εNTDGCod" 
      unfolding op_ntcf_components cat_op_simps ε_components
      by simp_all
    show "a  𝒟 (op_ntcf (op_ntcf ε))  op_ntcf (op_ntcf ε)a = εa" for a
      by (unfold dom_lhs, elim_in_numeral, fold nt_field_simps, unfold sup)
        (simp_all add: cat_op_simps)
  qed (auto simp: op_ntcf_def)
  let ?lara = cf_la_of_ra F (op_cf 𝔉) (εNTMap)
  have lara_ObjMap_eq_op: "?laraObjMap = (op_cf ?laraObjMap)"
    and lara_ArrMap_eq_op: "?laraArrMap = (op_cf ?laraArrMap)"
    by (simp_all add: cat_op_simps del: op_cf_cf_la_of_ra_op)
  have seq: "vfsequence (op_ntcf ε)" unfolding op_ntcf_def by auto
  have card: "vcard (op_ntcf ε) = 5" 
    unfolding op_ntcf_def by (simp add: nat_omega_simps)
  have op_cf_NTCod: "op_cf (εNTCod) = cf_id (op_cat 𝔇)"
    unfolding ε_components cat_op_simps by simp
  from assms(3) have op_cf_NTDom:
    "op_cf (εNTDom) = op_cf 𝔉 CF cf_la_of_ra F (op_cf 𝔉) (εNTMap)"
    unfolding ε_components  
    by
      (
        simp 
          add: cat_op_simps 𝔊_def cf_ra_of_la_def ε_components(1)[symmetric] 
          del: op_cf_cf_la_of_ra_op
      )
  note cf_la_of_ra_is_ntcf
    [
      where F=F and ηm=εNTMap,
      OF is_functor.is_functor_op[OF assms(3)],
      unfolded cat_op_simps,
      OF assms(4),
      unfolded ε_components(1),
      folded op_cf_NTCod op_cf_NTDom[unfolded ε_components(1)]  ε_components(1),
      folded op_ntcf_def[of ε, unfolded ε_components(4,5)],
      unfolded 
        cat_op_simps 
        lara_ObjMap_eq_op lara_ArrMap_eq_op cf_ra_of_la_def[symmetric],
      folded 𝔊_def,
      simplified,
      OF 
        assms(5)  
        cf_ra_of_la_commute_op[
          OF assms(3,5,6)[unfolded 𝔊_def], folded 𝔊_def
          ]
        assms(7,8),
      unfolded ε_components,
      simplified
    ]
  from is_ntcf.is_ntcf_op[OF this, unfolded cat_op_simps 𝔊_def[symmetric]] show 
    "ε : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇".
qed

lemma cf_ra_of_la_is_counit: 
  fixes F 𝔇 𝔉 𝔊 εm ε
  defines "𝔊  cf_ra_of_la F 𝔉 εm"
    and "ε  [εm, 𝔉 CF 𝔊, cf_id 𝔇, 𝔇, 𝔇]"
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "d. d  𝔇Obj  F d  Obj"
    and "d. d  𝔇Obj 
      universal_arrow_fo 𝔉 d (𝔊ObjMapd) (εNTMapd)"
    and "d d' h. h : d 𝔇d' 
      εNTMapd' A𝔇𝔉ArrMap𝔊ArrMaph = h A𝔇εNTMapd"
    and "vfsequence ε"
    and "vsv (εNTMap)"
    and "𝒟 (εNTMap) = 𝔇Obj"
  shows "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
proof-
  have ε_components: 
    "εNTMap = εm"
    "εNTDom = 𝔉 CF 𝔊"
    "εNTCod = cf_id 𝔇"
    "εNTDGDom = 𝔇"
    "εNTDGCod = 𝔇"
    unfolding ε_def nt_field_simps by (simp_all add: nat_omega_simps)
  note 𝔊_def = 𝔊_def[folded ε_components(1)]
  note 𝔉 = cf_ra_of_la_is_functor[
    where F=F and ε=εNTMap, OF assms(5-8)[unfolded 𝔊_def], simplified
    ]
  note ε = cf_ra_of_la_is_ntcf
    [
      where F=F and εm=εm and 𝔇=𝔇 and 𝔉=𝔉, 
      folded 𝔊_def[unfolded ε_components(1)], 
      folded ε_def, 
      OF assms(5-8) assms(10,11),
      simplified
    ]
  show "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
    by 
      (
        intro cf_adjunction_of_counit_is_cf_adjunction
          [
            OF assms(3-5) 𝔉, 
            folded 𝔊_def, 
            OF ε assms(7)[folded 𝔊_def], 
            simplified
          ]
      )+
qed



subsection‹Construction of an adjunction from the counit-unit equations›


text‹
The subsection presents the construction of an adjunction given 
two natural transformations satisfying counit-unit equations.
The content of this subsection follows the statement and the proof
of Theorem 2-v in Chapter IV-1 in cite"mac_lane_categories_2010".
›

lemma counit_unit_is_cf_adjunction:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
    and "ε : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
    and "(𝔊 CF-NTCF ε) NTCF (η NTCF-CF 𝔊) = ntcf_id 𝔊"
    and "(ε NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF η) = ntcf_id 𝔉"
  shows "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
    and "εC (cf_adjunction_of_unit α 𝔉 𝔊 η) = ε"
proof-

  interpret: category α  by (rule assms(1))
  interpret 𝔇: category α 𝔇 by (rule assms(2))
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(4))
  interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 η by (rule assms(5))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 ε by (rule assms(6))

  have 𝔊εx_η𝔊x[cat_cs_simps]:
    "𝔊ArrMapεNTMapx AηNTMap𝔊ObjMapx = CId𝔊ObjMapx"
    if "x  𝔇Obj" for x
  proof-
    from assms(7) have 
      "((𝔊 CF-NTCF ε) NTCF (η NTCF-CF 𝔊))NTMapx = ntcf_id 𝔊NTMapx"
      by simp
    from this assms(1-6) that show 
      "𝔊ArrMapεNTMapx AηNTMap𝔊ObjMapx = 
        CId𝔊ObjMapx"
      by (cs_prems cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
  qed
  have [cat_cs_simps]:
    "𝔊ArrMapεNTMapx A(ηNTMap𝔊ObjMapx Af) =
      CId𝔊ObjMapx Af"
    if "x  𝔇Obj" and "f : a 𝔊ObjMapx" for x f a
    using assms(1-6) that
    by (intro ℭ.cat_assoc_helper)
      (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)+

  have [cat_cs_simps]:
    "εNTMap𝔉ObjMapx A𝔇𝔉ArrMapηNTMapx = 𝔇CId𝔉ObjMapx"
    if "x  Obj" for x
  proof-
    from assms(8) have 
      "((ε NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF η))NTMapx = ntcf_id 𝔉NTMapx"
      by simp
    from this assms(1-6) that show
      "εNTMap𝔉ObjMapx A𝔇𝔉ArrMapηNTMapx = 𝔇CId𝔉ObjMapx"
      by (cs_prems cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
  qed

  have ua_𝔉x_ηx: "universal_arrow_of 𝔊 x (𝔉ObjMapx) (ηNTMapx)"
    if "x  Obj" for x 
  proof(intro is_functor.universal_arrow_ofI)
    from assms(3) that show "𝔉ObjMapx  𝔇Obj"
      by (cs_concl cs_shallow cs_intro: cat_cs_intros)
    from assms(3-6) that show "ηNTMapx : x 𝔊ObjMap𝔉ObjMapx"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
    fix r' u' assume prems': "r'  𝔇Obj" "u' : x 𝔊ObjMapr'"
    show "∃!f'.
      f' : 𝔉ObjMapx 𝔇r' 
      u' = umap_of 𝔊 x (𝔉ObjMapx) (ηNTMapx) r'ArrValf'"
    proof(intro ex1I conjI; (elim conjE)?)
      from assms(3-6) that prems' show 
        "εNTMapr' A𝔇𝔉ArrMapu' : 𝔉ObjMapx 𝔇r'"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      from assms(3-6) prems' have 𝔊𝔉u':
        "(𝔊 CF 𝔉)ArrMapu' = 𝔊ArrMap𝔉ArrMapu'"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      note [cat_cs_simps] = 
        η.ntcf_Comp_commute[symmetric, OF prems'(2), unfolded 𝔊𝔉u']
      from assms(3-6) that prems' show 
        "u' =
          umap_of 𝔊 x (𝔉ObjMapx) (ηNTMapx) r'ArrValεNTMapr' A𝔇𝔉ArrMapu'"
        by 
          (
            cs_concl cs_shallow
              cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_prod_cs_intros
          )
      fix f' assume prems'':
        "f' : 𝔉ObjMapx 𝔇r'"
        "u' = umap_of 𝔊 x (𝔉ObjMapx) (ηNTMapx) r'ArrValf'" 
      from prems''(2,1) assms(3-6) that have u'_def:
        "u' = 𝔊ArrMapf' AηNTMapx"
        by 
          (
            cs_prems cs_shallow
              cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_prod_cs_intros
          )
      from 
        ε.ntcf_Comp_commute[OF prems''(1)] 
        assms(3-6) 
        prems''(1) 
      have [cat_cs_simps]:
        "εNTMapr' A𝔇𝔉ArrMap𝔊ArrMapf' =
          f' A𝔇εNTMap𝔉ObjMapx"
        by (cs_prems cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      have [cat_cs_simps]:
        "εNTMapr' A𝔇(𝔉ArrMap𝔊ArrMapf' A𝔇f) =
          (f' A𝔇εNTMap𝔉ObjMapx) A𝔇f"
        if "f : a 𝔇𝔉ObjMap𝔊ObjMap𝔉ObjMapx" for f a
        using assms(1-6) prems''(1) prems' that
        by (intro 𝔇.cat_assoc_helper)
          (
            cs_concl 
              cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_prod_cs_intros
          )+
      from prems''(2,1) assms(3-6) that show 
        "f' = εNTMapr' A𝔇𝔉ArrMapu'"
        unfolding u'_def 
        by 
          (
            cs_concl cs_shallow
              cs_simp: cat_cs_simps cs_intro: cat_cs_intros cat_prod_cs_intros
          )
    qed
  qed (auto intro: cat_cs_intros)

  show aou: "cf_adjunction_of_unit α 𝔉 𝔊 η : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    by (intro cf_adjunction_of_unit_is_cf_adjunction ua_𝔉x_ηx assms(1-5))
  from ℭ.category_axioms 𝔇.category_axioms show 
    "ηC (cf_adjunction_of_unit α 𝔉 𝔊 η) = η"
    by 
      (
        cs_concl cs_shallow 
          cs_intro: cf_adjunction_of_unit_is_cf_adjunction assms(1-5) ua_𝔉x_ηx
      )

  interpret aou: is_cf_adjunction α  𝔇 𝔉 𝔊 cf_adjunction_of_unit α 𝔉 𝔊 η
    by (rule aou)

  show "εC (cf_adjunction_of_unit α 𝔉 𝔊 η) = ε"
  proof(rule ntcf_eqI)
    show ε_η: "εC (cf_adjunction_of_unit α 𝔉 𝔊 η) :
      𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
      by (rule aou.cf_adjunction_counit_is_ntcf)
    from assms(1-6) ε_η have dom_lhs:
      "𝒟 (εC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMap) = 𝔇Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps)
    from assms(1-6) ε_η have dom_rhs: "𝒟 (εNTMap) = 𝔇Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps)
    show "εC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMap = εNTMap"
    proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
      fix a assume "a  𝔇Obj"
      with aou.is_cf_adjunction_axioms assms(1-6) show 
        "εC (cf_adjunction_of_unit α 𝔉 𝔊 η)NTMapa = εNTMapa"
        by
          (
            cs_concl 
              cs_intro:
                cat_arrow_cs_intros
                cat_op_intros
                cat_cs_intros
                cat_prod_cs_intros
              cs_simp: 
                aou.cf_adj_umap_of_unit'[symmetric]
                cat_Set_the_inverse[symmetric]
                adj_cs_simps cat_cs_simps cat_op_simps
          )
    qed (auto simp: adj_cs_intros)
  qed (auto simp: assms) 

qed

lemma counit_unit_cf_adjunction_of_counit_is_cf_adjunction:
  assumes "category α "
    and "category α 𝔇"
    and "𝔉 :  ↦↦Cα𝔇"
    and "𝔊 : 𝔇 ↦↦Cα"
    and "η : cf_id  CF 𝔊 CF 𝔉 :  ↦↦Cα"
    and "ε : 𝔉 CF 𝔊 CF cf_id 𝔇 : 𝔇 ↦↦Cα𝔇"
    and "(𝔊 CF-NTCF ε) NTCF (η NTCF-CF 𝔊) = ntcf_id 𝔊"
    and "(ε NTCF-CF 𝔉) NTCF (𝔉 CF-NTCF η) = ntcf_id 𝔉"
  shows "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    and "ηC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = η"
    and "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
proof-

  interpret: category α  by (rule assms(1))
  interpret 𝔇: category α 𝔇 by (rule assms(2))
  interpret 𝔉: is_functor α  𝔇 𝔉 by (rule assms(3))
  interpret 𝔊: is_functor α 𝔇  𝔊 by (rule assms(4))
  interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 η by (rule assms(5))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 ε by (rule assms(6))

  have unit_op: "cf_adjunction_of_unit α (op_cf 𝔊) (op_cf 𝔉) (op_ntcf ε) :
    op_cf 𝔊 CF op_cf 𝔉 : op_cat 𝔇 ⇌⇌Cαop_cat "
    by (rule counit_unit_is_cf_adjunction(1)[where ε=op_ntcf η])
      (
        cs_concl 
          cs_simp:
            cat_op_simps cat_cs_simps 
            𝔊.cf_ntcf_id_op_cf
            𝔉.cf_ntcf_id_op_cf
            op_ntcf_ntcf_vcomp[symmetric]
            op_ntcf_ntcf_cf_comp[symmetric]
            op_ntcf_cf_ntcf_comp[symmetric]
            assms(7,8) 
          cs_intro: cat_op_intros cat_cs_intros
      )+
  then show aou: "cf_adjunction_of_counit α 𝔉 𝔊 ε : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇"
    unfolding cf_adjunction_of_counit_def
    by
      (
        subst 𝔉.cf_op_cf_op_cf[symmetric],
        subst 𝔊.cf_op_cf_op_cf[symmetric],
        subst ℭ.cat_op_cat_op_cat[symmetric],
        subst 𝔇.cat_op_cat_op_cat[symmetric],
        rule is_cf_adjunction_op
      )

  interpret aou: is_cf_adjunction α  𝔇 𝔉 𝔊 cf_adjunction_of_counit α 𝔉 𝔊 ε
    by (rule aou)

  show "ηC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = η"
    unfolding cf_adjunction_of_counit_def
    by (*slow*)
      (
        cs_concl_step is_cf_adjunction.op_ntcf_cf_adjunction_counit[symmetric], 
        rule unit_op, 
        cs_concl_step counit_unit_is_cf_adjunction(3)[where ε=op_ntcf η],
        insert ℭ.category_op 𝔇.category_op,
        rule 𝔇.category_op, rule ℭ.category_op
      )
      (
        cs_concl 
          cs_simp:
            cat_op_simps cat_cs_simps 
            𝔊.cf_ntcf_id_op_cf
            𝔉.cf_ntcf_id_op_cf
            op_ntcf_ntcf_vcomp[symmetric]
            op_ntcf_ntcf_cf_comp[symmetric]
            op_ntcf_cf_ntcf_comp[symmetric]
            assms(7,8) 
          cs_intro: cat_op_intros cat_cs_intros
      )+ 

  show "εC (cf_adjunction_of_counit α 𝔉 𝔊 ε) = ε"
    unfolding cf_adjunction_of_counit_def
    by
      (
        cs_concl_step is_cf_adjunction.op_ntcf_cf_adjunction_unit[symmetric], 
        rule unit_op, 
        cs_concl_step counit_unit_is_cf_adjunction(2)[where ε=op_ntcf η],
        insert ℭ.category_op 𝔇.category_op,
        rule 𝔇.category_op, rule ℭ.category_op
      )
      (
        cs_concl 
          cs_simp:
            cat_op_simps cat_cs_simps 
            𝔊.cf_ntcf_id_op_cf
            𝔉.cf_ntcf_id_op_cf
            op_ntcf_ntcf_vcomp[symmetric]
            op_ntcf_ntcf_cf_comp[symmetric]
            op_ntcf_cf_ntcf_comp[symmetric]
            assms(7,8) 
          cs_intro: cat_op_intros cat_cs_intros
      )+

qed



subsection‹Adjoints are unique up to isomorphism›


text‹
The content of the following subsection is based predominantly on
the statement and the proof of Corollary 1 in 
Chapter IV-1 in cite"mac_lane_categories_2010". However, similar 
results can also be found in section 4 in cite"riehl_category_2016"
and in subsection 2.1 in cite"bodo_categories_1970".
›


subsubsection‹Definitions and elementary properties›

definition cf_adj_LR_iso :: "V  V  V  V  V  V  V  V"
  where "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ =
    [
      (
        λxObj. THE f'.
        let
          η = ηC Φ;
          η' = ηC Ψ;
          𝔉x = 𝔉ObjMapx;
          𝔉'x = 𝔉'ObjMapx
        in
          f' : 𝔉x 𝔇𝔉'x 
          η'NTMapx = umap_of 𝔊 x (𝔉x) (ηNTMapx) (𝔉'x)ArrValf'
      ),
      𝔉,
      𝔉',
      ,
      𝔇
    ]"

definition cf_adj_RL_iso :: "V  V  V  V  V  V  V  V"
  where "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ =
    [
      (
        λx𝔇Obj. THE f'.
        let
          ε = εC Φ;
          ε' = εC Ψ;
          𝔊x = 𝔊ObjMapx;
          𝔊'x = 𝔊'ObjMapx
        in
          f' : 𝔊'x 𝔊x 
          ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf'
      ),
      𝔊',
      𝔊,
      𝔇,
      
    ]"


text‹Components.›

lemma cf_adj_LR_iso_components:
  shows "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTMap =
    (
      λxObj. THE f'.
      let
        η = ηC Φ;
        η' = ηC Ψ;
        𝔉x = 𝔉ObjMapx;
        𝔉'x = 𝔉'ObjMapx
      in
        f' : 𝔉x 𝔇𝔉'x 
        η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf'
    )"
    and [adj_cs_simps]: "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTDom = 𝔉"
    and [adj_cs_simps]: "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTCod = 𝔉'"
    and [adj_cs_simps]: "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTDGDom = "
    and [adj_cs_simps]: "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTDGCod = 𝔇"
  unfolding cf_adj_LR_iso_def nt_field_simps
  by (simp_all add: nat_omega_simps) (*slow*)

lemma cf_adj_RL_iso_components:
  shows "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTMap =
    (
        λx𝔇Obj. THE f'.
        let
          ε = εC Φ;
          ε' = εC Ψ;
          𝔊x = 𝔊ObjMapx;
          𝔊'x = 𝔊'ObjMapx
        in
          f' : 𝔊'x 𝔊x 
          ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf'
    )"
    and [adj_cs_simps]: "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTDom = 𝔊'"
    and [adj_cs_simps]: "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTCod = 𝔊"
    and [adj_cs_simps]: "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTDGDom = 𝔇"
    and [adj_cs_simps]: "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTDGCod = "
  unfolding cf_adj_RL_iso_def nt_field_simps
  by (simp_all add: nat_omega_simps) (*slow*)


subsubsection‹Natural transformation map›

lemma cf_adj_LR_iso_vsv[adj_cs_intros]: 
  "vsv (cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTMap)"
  unfolding cf_adj_LR_iso_components by simp

lemma cf_adj_RL_iso_vsv[adj_cs_intros]: 
  "vsv (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTMap)"
  unfolding cf_adj_RL_iso_components by simp

lemma cf_adj_LR_iso_vdomain[adj_cs_simps]:
  "𝒟 (cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTMap) = Obj"
  unfolding cf_adj_LR_iso_components by simp

lemma cf_adj_RL_iso_vdomain[adj_cs_simps]:
  "𝒟 (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTMap) = 𝔇Obj"
  unfolding cf_adj_RL_iso_components by simp

lemma cf_adj_LR_iso_app:
  fixes  𝔇 𝔊 𝔉 Φ 𝔉' Ψ
  assumes "x  Obj"
  defines "𝔉x  𝔉ObjMapx"
    and "𝔉'x  𝔉'ObjMapx"
    and "η  ηC Φ" 
    and "η'  ηC Ψ"
  shows "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTMapx =
    (
      THE f'.
        f' : 𝔉x 𝔇𝔉'x 
        η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf'
    )"
  using assms(1) unfolding cf_adj_LR_iso_components assms(2-5) by simp meson

lemma cf_adj_RL_iso_app:
  fixes  𝔇 𝔉 𝔊 Φ 𝔊' Ψ
  assumes "x  𝔇Obj"
  defines "𝔊x  𝔊ObjMapx"
    and "𝔊'x  𝔊'ObjMapx"
    and "ε  εC Φ" 
    and "ε'  εC Ψ"
  shows "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTMapx =
    (
      THE f'.
        f' : 𝔊'x 𝔊x 
        ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf'
    )"
  using assms(1) unfolding cf_adj_RL_iso_components assms(2-5) Let_def by simp

lemma cf_adj_LR_iso_app_unique:
  fixes  𝔇 𝔊 𝔉 Φ 𝔉' Ψ
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" 
    and "Ψ : 𝔉' CF 𝔊 :  ⇌⇌Cα𝔇" 
    and "x  Obj"
  defines "𝔉x  𝔉ObjMapx"
    and "𝔉'x  𝔉'ObjMapx"
    and "η  ηC Φ" 
    and "η'  ηC Ψ"
    and "f  cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' ΨNTMapx"
  shows
    "∃!f'.
      f' : 𝔉x 𝔇𝔉'x 
      η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf'"
    "f : 𝔉x iso𝔇𝔉'x"
    "η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉' 𝔊 Ψ by (rule assms(2))
  note 𝔉a_η =
    is_cf_adjunction.cf_adjunction_unit_component_is_ua_of[
      OF assms(1) assms(3), folded assms(4-8)
      ]
  note 𝔉'a_η = 
    is_cf_adjunction.cf_adjunction_unit_component_is_ua_of[
      OF assms(2) assms(3), folded assms(4-8)
      ]
  from 
    is_functor.cf_universal_arrow_of_unique[
      OF Φ.RL.is_functor_axioms 𝔉a_η 𝔉'a_η, folded assms(4-8)
      ]
  obtain f' 
    where f': "f' : 𝔉x 𝔇𝔉'x"
      and η'_def: 
        "η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf'"
      and unique_f': 
        "
          f'' : 𝔉x 𝔇𝔉'x;
          η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf''
          f'' = f'"
    for f''
    by metis
  show unique_f': "∃!f'.
    f' : 𝔉x 𝔇𝔉'x 
    η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf'"
    by 
      (
        rule is_functor.cf_universal_arrow_of_unique[
          OF Φ.RL.is_functor_axioms 𝔉a_η 𝔉'a_η, folded assms(4-8)
          ]
      )
  from
    theD
      [
        OF unique_f' cf_adj_LR_iso_app[
          OF assms(3), of 𝔇 𝔊 𝔉 Φ 𝔉' Ψ, folded assms(4-8)
          ]
      ]
  have f: "f : 𝔉x 𝔇𝔉'x"
    and η': "η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf"
    by simp_all
  show "η'NTMapx = umap_of 𝔊 x 𝔉x (ηNTMapx) 𝔉'xArrValf" by (rule η')
  show "f : 𝔉x iso𝔇𝔉'x"
    by
      (
        rule 
          is_functor.cf_universal_arrow_of_is_iso_arr[
            OF Φ.RL.is_functor_axioms 𝔉a_η 𝔉'a_η f η'
            ]
      )
qed


subsubsection‹Main results›

lemma cf_adj_LR_iso_is_iso_functor:
  ―‹See Corollary 1 in Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" and "Ψ : 𝔉' CF 𝔊 :  ⇌⇌Cα𝔇" 
  shows "∃!θ. θ : 𝔉 CF 𝔉' :  ↦↦Cα𝔇  ηC Ψ = (𝔊 CF-NTCF θ) NTCF ηC Φ"
    and "cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ : 𝔉 CF.iso 𝔉' :  ↦↦Cα𝔇"
    and "ηC Ψ = (𝔊 CF-NTCF cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ) NTCF ηC Φ"
proof-

  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉' 𝔊 Ψ by (rule assms(2))

  let  = ηC Φ
  let ?η' = ηC Ψ
  let ?ΦΨ = cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ

  show 𝔉'Ψ: "?ΦΨ : 𝔉 CF.iso 𝔉' :  ↦↦Cα𝔇"
  proof(intro is_iso_ntcfI is_ntcfI')

    show "vfsequence ?ΦΨ" unfolding cf_adj_LR_iso_def by auto
    show "vcard ?ΦΨ = 5" 
      unfolding cf_adj_LR_iso_def by (simp add: nat_omega_simps)
    show "?ΦΨNTMapa : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
      if "a  Obj" for a
      using cf_adj_LR_iso_app_unique(2)[OF assms that] by auto

    show "?ΦΨNTMapb A𝔇𝔉ArrMapf = 𝔉'ArrMapf A𝔇?ΦΨNTMapa"
      if "f : a b" for a b f
    proof-

      from that have a: "a  Obj" and b: "b  Obj" by auto
      note unique_a = cf_adj_LR_iso_app_unique[OF assms a]
      note unique_b = cf_adj_LR_iso_app_unique[OF assms b]

      from unique_a(2) have a_is_arr:
        "?ΦΨNTMapa : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
        by auto
      from unique_b(2) have b_is_arr:
        "?ΦΨNTMapb : 𝔉ObjMapb 𝔇𝔉'ObjMapb"
        by auto

      interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 
        by (rule Φ.cf_adjunction_unit_is_ntcf)
      interpret η': is_ntcf α   cf_id  𝔊 CF 𝔉' ?η'
        by (rule Ψ.cf_adjunction_unit_is_ntcf)

      from unique_a(3) a_is_arr a b have η'_a_def: 
        "?η'NTMapa = 𝔊ArrMap?ΦΨNTMapa ANTMapa"
        by 
          (
            cs_prems cs_shallow
              cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
          )
      from unique_b(3) b_is_arr a b have η'_b_def:
        "?η'NTMapb = 𝔊ArrMap?ΦΨNTMapb ANTMapb"
        by 
          (
            cs_prems cs_shallow 
              cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
          )
     
      from that a b a_is_arr have 
        "𝔊ArrMap𝔉'ArrMapf A(𝔊ArrMap?ΦΨNTMapa ANTMapa) = 
            𝔊ArrMap𝔉'ArrMapf A?η'NTMapa"
        by
          (
            cs_concl cs_shallow 
              cs_simp: cat_cs_simps η'_a_def cs_intro: cat_cs_intros
          )
      also from η'.ntcf_Comp_commute[OF that, symmetric] that a b have 
        " = ?η'NTMapb Af"
        by (cs_prems cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      also from that a b b_is_arr have
        " = 𝔊ArrMap?ΦΨNTMapb A(NTMapb Af)" 
        by 
          ( 
            cs_concl cs_shallow 
              cs_simp: cat_cs_simps η'_b_def cs_intro: cat_cs_intros
          )
      also from that have 
        " = 𝔊ArrMap?ΦΨNTMapb A((𝔊 CF 𝔉)ArrMapf ANTMapa)"
        unfolding η.ntcf_Comp_commute[OF that, symmetric]
        by 
          (
            cs_concl cs_shallow 
              cs_simp: cat_cs_simps η'_b_def cs_intro: cat_cs_intros
          )
      also from that b_is_arr have 
        " = 𝔊ArrMap?ΦΨNTMapb A(𝔊ArrMap𝔉ArrMapf ANTMapa)"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
      finally have [cat_cs_simps]:
        "𝔊ArrMap𝔉'ArrMapf A(𝔊ArrMap?ΦΨNTMapa ANTMapa) =
          𝔊ArrMap?ΦΨNTMapb A(𝔊ArrMap𝔉ArrMapf ANTMapa)"
        by simp

      note unique_f_a = is_functor.universal_arrow_ofD
        [
          OF 
            Φ.RL.is_functor_axioms 
            Φ.cf_adjunction_unit_component_is_ua_of[OF a]
        ]

      from that a b a_is_arr b_is_arr have 𝔊𝔉f_ηa:
        "𝔊ArrMap𝔉'ArrMapf  A?η'NTMapa :
          a 𝔊ObjMap𝔉'ObjMapb"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)

      from b have 𝔉'b: "𝔉'ObjMapb  𝔇Obj"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)

      from unique_f_a(3)[OF 𝔉'b 𝔊𝔉f_ηa] obtain f' 
        where f': "f' : 𝔉ObjMapa 𝔇𝔉'ObjMapb"
          and ηa: "𝔊ArrMap𝔉'ArrMapf A?η'NTMapa =
          umap_of 𝔊 a (𝔉ObjMapa) (NTMapa) (𝔉'ObjMapb)ArrValf'"
          and unique_f':
            "
              f'' : 𝔉ObjMapa 𝔇𝔉'ObjMapb;
              𝔊ArrMap𝔉'ArrMapf A?η'NTMapa =
                umap_of 𝔊 a (𝔉ObjMapa) (NTMapa) (𝔉'ObjMapb)ArrValf''
               f'' = f'"
        for f''
        by metis
      have "?ΦΨNTMapb A𝔇𝔉ArrMapf = f'"
        by (rule unique_f', insert a b a_is_arr b_is_arr that)
          (
            cs_concl cs_shallow 
              cs_simp: η'_a_def cat_cs_simps cs_intro: cat_cs_intros
          )
      moreover have "𝔉'ArrMapf A𝔇?ΦΨNTMapa = f'"
        by (rule unique_f', insert a b a_is_arr b_is_arr that)
          (
            cs_concl cs_shallow 
              cs_simp: η'_a_def cat_cs_simps cs_intro: cat_cs_intros
          )
      ultimately show ?thesis by simp
    qed 

  qed 
    (
      auto 
        intro: cat_cs_intros adj_cs_intros  
        simp: adj_cs_simps cf_adj_LR_iso_app_unique(2)[OF assms]
    )

  interpret 𝔉'Ψ: is_iso_ntcf α  𝔇 𝔉 𝔉' ?ΦΨ by (rule 𝔉'Ψ)

  show η'_def: "?η' = 𝔊 CF-NTCF ?ΦΨ NTCF ηC Φ"
  proof(rule ntcf_eqI)
    have dom_lhs: "𝒟 (?η'NTMap) = Obj"
      by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: adj_cs_intros)
    have dom_rhs: "𝒟 ((𝔊 CF-NTCF ?ΦΨ NTCF ηC Φ)NTMap) = Obj"
      by 
        (
          cs_concl cs_shallow 
            cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
        )
    show "?η'NTMap = (𝔊 CF-NTCF ?ΦΨ NTCF ηC Φ)NTMap"
    proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
      fix a assume prems: "a  Obj"
      note unique_a = cf_adj_LR_iso_app_unique[OF assms prems]
      from unique_a(2) have a_is_arr:
        "?ΦΨNTMapa : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
        by auto  
      interpret η: is_ntcf α   cf_id  𝔊 CF 𝔉 
        by (rule Φ.cf_adjunction_unit_is_ntcf)
      from unique_a(3) a_is_arr prems have η'_a_def: 
        "?η'NTMapa = 𝔊ArrMap?ΦΨNTMapa AηC ΦNTMapa"
        by
          (
            cs_prems cs_shallow 
              cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
          )
      from prems a_is_arr show 
        "?η'NTMapa =  (𝔊 CF-NTCF ?ΦΨ NTCF )NTMapa"
        by 
          (
            cs_concl cs_shallow 
              cs_simp: η'_a_def cat_cs_simps cs_intro: cat_cs_intros
          )
    qed (auto intro: cat_cs_intros adj_cs_intros)
  qed 
    (
      cs_concl cs_shallow 
        cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
    )+

  show "∃!θ. θ : 𝔉 CF 𝔉' :  ↦↦Cα𝔇  ?η' = (𝔊 CF-NTCF θ) NTCF "
  proof(intro ex1I conjI; (elim conjE)?)
    from 𝔉'Ψ show "?ΦΨ : 𝔉 CF 𝔉' :  ↦↦Cα𝔇" by auto
    show "?η' = 𝔊 CF-NTCF ?ΦΨ NTCF ηC Φ" by (rule η'_def)
    fix θ assume prems:
      "θ : 𝔉 CF 𝔉' :  ↦↦Cα𝔇"
      "?η' = 𝔊 CF-NTCF θ NTCF ηC Φ"
    interpret θ: is_ntcf α  𝔇 𝔉 𝔉' θ by (rule prems(1))
    from prems have η'_a: 
      "?η'NTMapa = (𝔊 CF-NTCF θ NTCF ηC Φ)NTMapa" 
      for a
      by simp
    have η'a: "ηC ΨNTMapa =
      𝔊ArrMapθNTMapa AηC ΦNTMapa"
      if "a  Obj" for a
      using η'_a[where a=a] that
      by 
        (
          cs_prems cs_shallow 
            cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
        )
    show "θ = ?ΦΨ"
    proof(rule ntcf_eqI)
      have dom_lhs: "𝒟 (θNTMap) = Obj" 
        by (cs_concl cs_shallow cs_simp: cat_cs_simps)
      have dom_rhs: "𝒟 (?ΦΨNTMap) = Obj"
        by (cs_concl cs_shallow cs_simp: cat_cs_simps)
      show "θNTMap = ?ΦΨNTMap"
      proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
        fix a assume prems': "a  Obj"
        let ?uof = umap_of 𝔊 a (𝔉ObjMapa) (NTMapa) (𝔉'ObjMapa)
        from cf_adj_LR_iso_app_unique[OF assms prems'] obtain f' 
          where f': "f' : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
            and η_def: "?η'NTMapa = ?uofArrValf'"
            and unique_f': "f''.
              
                f'' : 𝔉ObjMapa 𝔇𝔉'ObjMapa;
                ?η'NTMapa = ?uofArrValf''
                f'' = f'"
          by metis
        from prems' have θa: "θNTMapa : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
          by (cs_concl cs_shallow cs_intro: cat_cs_intros)
        from η_def f' prems' have 
          "ηC ΨNTMapa = 𝔊ArrMapf' AηC ΦNTMapa"
          by 
            (
              cs_prems
                cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
            )
        from prems' have "ηC ΨNTMapa = ?uofArrValθNTMapa"
          by 
            (
              cs_concl
                cs_simp: cat_cs_simps η'a[OF prems'] 
                cs_intro: adj_cs_intros cat_cs_intros
            )
        from unique_f'[OF θa this] have θa: "θNTMapa = f'".
        from prems' have Ψa: 
          "?ΦΨNTMapa : 𝔉ObjMapa 𝔇𝔉'ObjMapa"
          by (cs_concl cs_shallow cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
        from prems' have "ηC ΨNTMapa = ?uofArrVal?ΦΨNTMapa"
          by
            (
              cs_concl
                cs_simp: cf_adj_LR_iso_app_unique(3)[OF assms] cat_cs_simps 
                cs_intro: adj_cs_intros cat_cs_intros
            )
        from unique_f'[OF Ψa this] have 𝔉'Ψ_def: "?ΦΨNTMapa = f'".
        show "θNTMapa = ?ΦΨNTMapa" unfolding θa 𝔉'Ψ_def ..
      qed auto
    qed (cs_concl cs_shallow cs_intro: cat_cs_intros)+
  qed

qed

lemma op_ntcf_cf_adj_RL_iso[cat_op_simps]:
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" 
    and "Ψ : 𝔉 CF 𝔊' :  ⇌⇌Cα𝔇" 
  defines "op_𝔇  op_cat 𝔇"
    and "op_ℭ  op_cat "
    and "op_𝔉  op_cf 𝔉"
    and "op_𝔊  op_cf 𝔊"
    and "op_Φ  op_cf_adj Φ"
    and "op_𝔊'  op_cf 𝔊'"
    and "op_Ψ  op_cf_adj Ψ"
  shows
    "op_ntcf (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ) =
      cf_adj_LR_iso op_𝔇 op_ℭ op_𝔉 op_𝔊 op_Φ op_𝔊' op_Ψ"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉 𝔊' Ψ by (rule assms(2))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 εC Φ
    by (rule Φ.cf_adjunction_counit_is_ntcf)
  have dom_lhs: "𝒟 (op_ntcf (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ)) = 5"
    unfolding op_ntcf_def by (simp add: nat_omega_simps)
  show ?thesis
  proof(rule vsv_eqI, unfold dom_lhs)
    fix a assume prems: "a  5"
    then have "a  5" unfolding dom_lhs by simp
    then show 
      "op_ntcf (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ)a =
        cf_adj_LR_iso op_𝔇 op_ℭ op_𝔉 op_𝔊 op_Φ op_𝔊' op_Ψa"
      by 
        (
          elim_in_numeral, 
          fold nt_field_simps, 
          unfold 
            cf_adj_LR_iso_components 
            op_ntcf_components 
            cf_adj_RL_iso_components
            Let_def
            Φ.cf_adjunction_unit_NTMap_op 
            Ψ.cf_adjunction_unit_NTMap_op
            assms(3-9)
            cat_op_simps
        )
        simp_all
  qed (auto simp: op_ntcf_def cf_adj_LR_iso_def nat_omega_simps)
qed

lemma op_ntcf_cf_adj_LR_iso[cat_op_simps]:
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" and "Ψ : 𝔉' CF 𝔊 :  ⇌⇌Cα𝔇" 
  defines "op_𝔇  op_cat 𝔇"
    and "op_ℭ  op_cat "
    and "op_𝔉  op_cf 𝔉"
    and "op_𝔊  op_cf 𝔊"
    and "op_Φ  op_cf_adj Φ"
    and "op_𝔉'  op_cf 𝔉'"
    and "op_Ψ  op_cf_adj Ψ"
  shows
    "op_ntcf (cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ) =
      cf_adj_RL_iso op_𝔇 op_ℭ op_𝔊 op_𝔉 op_Φ op_𝔉' op_Ψ"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉' 𝔊 Ψ by (rule assms(2))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 εC Φ
    by (rule Φ.cf_adjunction_counit_is_ntcf)
  have dom_lhs: "𝒟 (op_ntcf (cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ)) = 5"
    unfolding op_ntcf_def by (simp add: nat_omega_simps)
  show ?thesis
  proof(rule vsv_eqI, unfold dom_lhs)
    fix a assume prems: "a  5"
    then show
      "op_ntcf (cf_adj_LR_iso  𝔇 𝔊 𝔉 Φ 𝔉' Ψ)a =
        cf_adj_RL_iso op_𝔇 op_ℭ op_𝔊 op_𝔉 op_Φ op_𝔉' op_Ψa"
      by
        (
          elim_in_numeral, 
          use nothing in 
            fold nt_field_simps,
              unfold 
                cf_adj_LR_iso_components
                op_ntcf_components
                cf_adj_RL_iso_components
                Let_def
                Φ.op_ntcf_cf_adjunction_unit[symmetric]
                Ψ.op_ntcf_cf_adjunction_unit[symmetric]
                assms(3-9)
                cat_op_simps
        )
        simp_all
  qed (auto simp: op_ntcf_def cf_adj_RL_iso_def nat_omega_simps)
qed

lemma cf_adj_RL_iso_app_unique:
  fixes  𝔇 𝔉 𝔊 Φ 𝔊' Ψ
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" 
    and "Ψ : 𝔉 CF 𝔊' :  ⇌⇌Cα𝔇" 
    and "x  𝔇Obj"
  defines "𝔊x  𝔊ObjMapx"
    and "𝔊'x  𝔊'ObjMapx"
    and "ε  εC Φ" 
    and "ε'  εC Ψ"
    and "f  cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' ΨNTMapx"
  shows
    "∃!f'.
      f' : 𝔊'x 𝔊x 
      ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf'"
    "f : 𝔊'x iso𝔊x"
    "ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉 𝔊' Ψ by (rule assms(2))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 εC Φ
    by (rule Φ.cf_adjunction_counit_is_ntcf)
  show
    "∃!f'.
      f' : 𝔊'x 𝔊x 
      ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf'"
    "f : 𝔊'x iso𝔊x"
    "ε'NTMapx = umap_fo 𝔉 x 𝔊x (εNTMapx) 𝔊'xArrValf"
    by 
      (
        intro cf_adj_LR_iso_app_unique
          [
            OF Φ.is_cf_adjunction_op Ψ.is_cf_adjunction_op,
            unfolded cat_op_simps,
            OF assms(3),
            unfolded Ψ.cf_adjunction_unit_NTMap_op,
            folded Φ.op_ntcf_cf_adjunction_counit,
            folded op_ntcf_cf_adj_RL_iso[OF assms(1,2)],
            unfolded cat_op_simps,
            folded assms(4-8)
          ]
      )+
qed

lemma cf_adj_RL_iso_is_iso_functor:
  ―‹See Corollary 1 in Chapter IV-1 in \cite{mac_lane_categories_2010}.›
  assumes "Φ : 𝔉 CF 𝔊 :  ⇌⇌Cα𝔇" and "Ψ : 𝔉 CF 𝔊' :  ⇌⇌Cα𝔇" 
  shows "∃!θ.
    θ : 𝔊' CF 𝔊 : 𝔇 ↦↦Cα 
    εC Ψ = εC Φ NTCF (𝔉 CF-NTCF θ)"
    and "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ : 𝔊' CF.iso 𝔊 : 𝔇 ↦↦Cα"
    and "εC Ψ =
      εC Φ NTCF (𝔉 CF-NTCF cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ)"
proof-
  interpret Φ: is_cf_adjunction α  𝔇 𝔉 𝔊 Φ by (rule assms(1))
  interpret Ψ: is_cf_adjunction α  𝔇 𝔉 𝔊' Ψ by (rule assms(2))
  interpret ε: is_ntcf α 𝔇 𝔇 𝔉 CF 𝔊 cf_id 𝔇 εC Φ
    by (rule Φ.cf_adjunction_counit_is_ntcf)
  note cf_adj_LR_iso_is_iso_functor_op = cf_adj_LR_iso_is_iso_functor
    [
      OF Φ.is_cf_adjunction_op Ψ.is_cf_adjunction_op,
      folded 
        Φ.op_ntcf_cf_adjunction_counit 
        Ψ.op_ntcf_cf_adjunction_counit
        op_ntcf_cf_adj_RL_iso[OF assms]
    ]
  from cf_adj_LR_iso_is_iso_functor_op(1) obtain θ 
    where θ: "θ : op_cf 𝔊 CF op_cf 𝔊' : op_cat 𝔇 ↦↦Cαop_cat "
      and op_ntcf_ε_def: "op_ntcf (εC Ψ) =
        op_cf 𝔉 CF-NTCF θ NTCF op_ntcf (εC Φ)"
      and unique_θ': 
        "
          θ' : op_cf 𝔊 CF op_cf 𝔊' : op_cat 𝔇 ↦↦Cαop_cat ;
          op_ntcf (εC Ψ) = op_cf 𝔉 CF-NTCF θ' NTCF op_ntcf (εC Φ)
           θ' = θ"
      for θ'
    by metis
  interpret θ: is_ntcf α op_cat 𝔇 op_cat  op_cf 𝔊 op_cf 𝔊' θ 
    by (rule θ)
  show "∃!θ. θ : 𝔊' CF 𝔊 : 𝔇 ↦↦Cα  εC Ψ = εC Φ NTCF (𝔉 CF-NTCF θ)"
  proof(intro ex1I conjI; (elim conjE)?)
    show op_θ: "op_ntcf θ : 𝔊' CF 𝔊 : 𝔇 ↦↦Cα"
      by (rule θ.is_ntcf_op[unfolded cat_op_simps])
    from op_ntcf_ε_def have
      "op_ntcf (op_ntcf (εC Ψ)) =
        op_ntcf (op_cf 𝔉 CF-NTCF θ NTCF op_ntcf (εC Φ))"
      by simp
    then show ε_def: "εC Ψ = εC Φ NTCF (𝔉 CF-NTCF op_ntcf θ)"
      by 
        (
          cs_prems cs_shallow
            cs_simp: cat_op_simps 
            cs_intro: adj_cs_intros cat_cs_intros cat_op_intros
        )
    fix θ' assume prems: 
      "θ' : 𝔊' CF 𝔊 : 𝔇 ↦↦Cα"
      "εC Ψ = εC Φ NTCF (𝔉 CF-NTCF θ')"
    interpret θ': is_ntcf α 𝔇  𝔊' 𝔊 θ' by (rule prems(1))   
    have "op_ntcf (εC Ψ) = op_cf 𝔉 CF-NTCF op_ntcf θ' NTCF op_ntcf (εC Φ)"
      by 
        (
          cs_concl cs_shallow
            cs_simp: 
              prems(2) 
              op_ntcf_cf_ntcf_comp[symmetric] 
              op_ntcf_ntcf_vcomp[symmetric] 
            cs_intro: cat_cs_intros
        )
    from unique_θ'[OF θ'.is_ntcf_op this, symmetric] have
      "op_ntcf θ = op_ntcf (op_ntcf θ')"
      by simp
    then show "θ' = op_ntcf θ"  
      by (cs_prems cs_shallow cs_simp: cat_cs_simps cat_op_simps) simp
  qed
  from is_iso_ntcf.is_iso_ntcf_op[OF cf_adj_LR_iso_is_iso_functor_op(2)] show 
    "cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ : 𝔊' CF.iso 𝔊 : 𝔇 ↦↦Cα"
    by 
      (
        cs_prems cs_shallow 
          cs_simp: cat_op_simps cs_intro: adj_cs_intros cat_op_intros
      )
  from cf_adj_LR_iso_is_iso_functor_op(3) have 
    "op_ntcf (op_ntcf (εC Ψ)) =
      op_ntcf
        (
          op_cf 𝔉 CF-NTCF op_ntcf (cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ) NTCF 
          op_ntcf (εC Φ)
        )"
    by simp
  from 
    this 
    cf_adj_LR_iso_is_iso_functor_op(2)[ 
      unfolded op_ntcf_cf_adj_RL_iso[OF assms]
      ]
  show "εC Ψ = εC Φ NTCF (𝔉 CF-NTCF cf_adj_RL_iso  𝔇 𝔉 𝔊 Φ 𝔊' Ψ)"
    by 
      (
        cs_prems cs_shallow
          cs_simp: cat_op_simps cat_op_simps 
          cs_intro: ntcf_cs_intros adj_cs_intros cat_cs_intros cat_op_intros
      )
qed



subsection‹Further properties of the adjoint functors›

lemma (in is_cf_adjunction) cf_adj_exp_cf_cat:
  ―‹See Proposition 4.4.6 in \cite{riehl_category_2016}.›
  assumes "𝒵 β" and "α  β" and "category α 𝔍"
  shows
    "cf_adjunction_of_unit
      β
      (exp_cf_cat α 𝔉 𝔍)
      (exp_cf_cat α 𝔊 𝔍)
      (exp_ntcf_cat α (ηC Φ) 𝔍) :
      exp_cf_cat α 𝔉 𝔍 CF exp_cf_cat α 𝔊 𝔍 :
      cat_FUNCT α 𝔍  ⇌⇌Cβcat_FUNCT α 𝔍 𝔇"
proof-
  interpret β: 𝒵 β by (rule assms(1))
  interpret 𝔍: category α 𝔍 by (rule assms(3))
  show ?thesis
  proof
    (
      rule counit_unit_is_cf_adjunction(1)[
        where ε = exp_ntcf_cat α (εC Φ) 𝔍
        ]
    )
    from assms show "exp_ntcf_cat α (ηC Φ) 𝔍 :
      cf_id (cat_FUNCT α 𝔍 ) CF exp_cf_cat α 𝔊 𝔍 CF exp_cf_cat α 𝔉 𝔍 :
      cat_FUNCT α 𝔍  ↦↦Cβcat_FUNCT α 𝔍 "
      by 
        (
          cs_concl 
            cs_simp:
              cat_cs_simps cat_FUNCT_cs_simps 
              exp_cf_cat_cf_id_cat[symmetric] exp_cf_cat_cf_comp[symmetric] 
            cs_intro:
              cat_cs_intros cat_small_cs_intros cat_FUNCT_cs_intros adj_cs_intros
        )
    from assms show 
      "exp_ntcf_cat α (εC Φ) 𝔍 :
        exp_cf_cat α 𝔉 𝔍 CF exp_cf_cat α 𝔊 𝔍 CF cf_id (cat_FUNCT α 𝔍 𝔇) :
        cat_FUNCT α 𝔍 𝔇 ↦↦Cβcat_FUNCT α 𝔍 𝔇"
      by
        (
          cs_concl 
            cs_simp:
              cat_cs_simps 
              cat_FUNCT_cs_simps 
              exp_cf_cat_cf_id_cat[symmetric] 
              exp_cf_cat_cf_comp[symmetric] 
            cs_intro:
              cat_cs_intros cat_small_cs_intros cat_FUNCT_cs_intros adj_cs_intros
        )
    note [symmetric, cat_cs_simps] =
      ntcf_id_exp_cf_cat 
      exp_ntcf_cat_ntcf_vcomp 
      exp_ntcf_cat_ntcf_cf_comp
      exp_ntcf_cat_cf_ntcf_comp
    from assms show
      "(exp_cf_cat α 𝔊 𝔍 CF-NTCF exp_ntcf_cat α (εC Φ) 𝔍) NTCF
        (exp_ntcf_cat α (ηC Φ) 𝔍 NTCF-CF exp_cf_cat α 𝔊 𝔍) =
        ntcf_id (exp_cf_cat α 𝔊 𝔍)"
      by 
        (
          cs_concl cs_shallow
            cs_simp: adj_cs_simps cat_cs_simps  
            cs_intro: adj_cs_intros cat_cs_intros
        )
    from assms show
      "exp_ntcf_cat α (εC Φ) 𝔍 NTCF-CF exp_cf_cat α 𝔉 𝔍 NTCF
      (exp_cf_cat α 𝔉 𝔍 CF-NTCF exp_ntcf_cat α (ηC Φ) 𝔍) =
      ntcf_id (exp_cf_cat α 𝔉 𝔍)"
      by 
        (
          cs_concl cs_shallow
            cs_simp: adj_cs_simps cat_cs_simps  
            cs_intro: adj_cs_intros cat_cs_intros
        )
  qed
    (
      use assms in 
        cs_concl 
            cs_intro: cat_cs_intros cat_small_cs_intros cat_FUNCT_cs_intros
    )+
qed

lemma (in is_cf_adjunction) cf_adj_exp_cf_cat_exp_cf_cat:
  ―‹See Proposition 4.4.6 in \cite{riehl_category_2016}.›
  assumes "𝒵 β" and "α  β" and "category α 𝔄"
  shows
    "cf_adjunction_of_unit
      β
      (exp_cat_cf α 𝔄 𝔊)
      (exp_cat_cf α 𝔄 𝔉)
      (exp_cat_ntcf α 𝔄 (ηC Φ)) :
      exp_cat_cf α 𝔄 𝔊 CF exp_cat_cf α 𝔄 𝔉 :
      cat_FUNCT α  𝔄 ⇌⇌Cβcat_FUNCT α 𝔇 𝔄"
proof-

  interpret β: 𝒵 β by (rule assms(1))
  interpret 𝔄: category α 𝔄 by (rule assms(3))

  show ?thesis
  proof
    (
      rule counit_unit_is_cf_adjunction(1)[
        where ε = exp_cat_ntcf α 𝔄 (εC Φ)
        ]
    )
    from assms is_cf_adjunction_axioms show
      "exp_cat_ntcf α 𝔄 (ηC Φ) :
        cf_id (cat_FUNCT α  𝔄) CF exp_cat_cf α 𝔄 𝔉 CF exp_cat_cf α 𝔄 𝔊 :
        cat_FUNCT α  𝔄 ↦↦Cβcat_FUNCT α  𝔄"
      by 
        (
          cs_concl 
            cs_simp:
              exp_cat_cf_cat_cf_id[symmetric] exp_cat_cf_cf_comp[symmetric] 
            cs_intro: cat_small_cs_intros cat_FUNCT_cs_intros adj_cs_intros
        )
    from assms is_cf_adjunction_axioms show 
      "exp_cat_ntcf α 𝔄 (εC Φ) :
        exp_cat_cf α 𝔄 𝔊 CF exp_cat_cf α 𝔄 𝔉 CF cf_id (cat_FUNCT α 𝔇 𝔄) :
        cat_FUNCT α 𝔇 𝔄 ↦↦Cβcat_FUNCT α 𝔇 𝔄"
      by
        (
          cs_concl 
            cs_simp: 
              exp_cat_cf_cat_cf_id[symmetric] exp_cat_cf_cf_comp[symmetric] 
            cs_intro: cat_small_cs_intros cat_FUNCT_cs_intros adj_cs_intros
        )
    note [symmetric, cat_cs_simps] =
      ntcf_id_exp_cat_cf
      exp_cat_ntcf_ntcf_vcomp
      exp_cat_ntcf_ntcf_cf_comp
      exp_cat_ntcf_cf_ntcf_comp
    from assms show
      "exp_cat_cf α 𝔄 𝔉 CF-NTCF exp_cat_ntcf α 𝔄 (εC Φ) NTCF
        (exp_cat_ntcf α 𝔄 (ηC Φ) NTCF-CF exp_cat_cf α 𝔄 𝔉) =
        ntcf_id (exp_cat_cf α 𝔄 𝔉)"
      by
        (
          cs_concl cs_shallow
            cs_simp: adj_cs_simps cat_cs_simps
            cs_intro: adj_cs_intros cat_cs_intros
        )
    from assms show
      "exp_cat_ntcf α 𝔄 (εC Φ) NTCF-CF exp_cat_cf α 𝔄 𝔊 NTCF
        (exp_cat_cf α 𝔄 𝔊 CF-NTCF exp_cat_ntcf α 𝔄 (ηC Φ)) =
          ntcf_id (exp_cat_cf α 𝔄 𝔊)"
      by 
        (
          cs_concl cs_shallow
            cs_simp: adj_cs_simps cat_cs_simps
            cs_intro: adj_cs_intros cat_cs_intros
        )
  qed
    (
      use assms in 
        cs_concl 
            cs_intro: cat_cs_intros cat_small_cs_intros cat_FUNCT_cs_intros
    )+

qed



subsection‹Adjoints on limits›

lemma cf_AdjRight_preserves_limits:
  ―‹See Chapter V-5 in \cite{mac_lane_categories_2010}.›
  assumes "Φ : 𝔉 CF 𝔊 : 𝔛 ⇌⇌Cα𝔄"
  shows "is_cf_continuous α 𝔊"
proof(intro is_cf_continuousI)
 
  interpret Φ: is_cf_adjunction α 𝔛 𝔄 𝔉 𝔊 Φ by (rule assms(1))

  show "𝔊 : 𝔄 ↦↦Cα𝔛" by (rule Φ.RL.is_functor_axioms)

  fix 𝔗 𝔍 assume prems: "𝔗 : 𝔍 ↦↦Cα𝔄"

  show "cf_preserves_limits α 𝔊 𝔗"
  proof(intro cf_preserves_limitsI, rule prems, rule Φ.RL.is_functor_axioms)

    fix τ a assume "τ : a <CF.lim 𝔗 : 𝔍 ↦↦Cα𝔄"
    then interpret τ: is_cat_limit α 𝔍 𝔄 𝔗 a τ . 

    show "𝔊 CF-NTCF τ : 𝔊ObjMapa <CF.lim 𝔊 CF 𝔗 : 𝔍 ↦↦Cα𝔛"
    proof(intro is_cat_limitI)

      show "𝔊 CF-NTCF τ : 𝔊ObjMapa <CF.cone 𝔊 CF 𝔗 : 𝔍 ↦↦Cα𝔛"
        by
          (
            intro cf_ntcf_comp_cf_cat_cone prems, 
            rule τ.is_cat_cone_axioms, 
            intro Φ.RL.is_functor_axioms
          )

      fix σ' b' assume "σ' : b' <CF.cone 𝔊 CF 𝔗 : 𝔍 ↦↦Cα𝔛"
      then interpret σ': is_cat_cone α b' 𝔍 𝔛 𝔊 CF 𝔗 σ' .

      have "εC Φ NTCF-CF 𝔗 : 𝔉 CF (𝔊 CF 𝔗) CF 𝔗 : 𝔍 ↦↦Cα𝔄"
        by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros adj_cs_intros)
      moreover have "𝔉 CF-NTCF σ' :
        𝔉ObjMapb' <CF.cone 𝔉 CF (𝔊 CF 𝔗) : 𝔍 ↦↦Cα𝔄"
        by 
          (
            intro cf_ntcf_comp_cf_cat_cone, 
            rule σ'.is_cat_cone_axioms, 
            rule Φ.LR.is_functor_axioms
          )
      ultimately have "(εC Φ NTCF-CF 𝔗) NTCF (𝔉 CF-NTCF σ') :
        𝔉ObjMapb' <CF.cone 𝔗 : 𝔍 ↦↦Cα𝔄"
        by (rule ntcf_vcomp_is_cat_cone)
      from τ.cat_lim_unique_cone'[OF this] obtain h 
        where h: "h : 𝔉ObjMapb' 𝔄a"
          and ε𝔗_𝔉σ': "j. j  𝔍Obj 
            ((εC Φ NTCF-CF 𝔗) NTCF (𝔉 CF-NTCF σ'))NTMapj = τNTMapj A𝔄h"
          and h_unique:
            "
              h' : 𝔉ObjMapb' 𝔄a;
              j. j  𝔍Obj 
                ((εC Φ NTCF-CF 𝔗) NTCF (𝔉 CF-NTCF σ'))NTMapj =
                  τNTMapj A𝔄h'
               h' = h"
        for h'
        by metis
      have ε𝔗_𝔉σ:
        "εC ΦNTMap𝔗ObjMapj A𝔄𝔉ArrMapσ'NTMapj = 
          τNTMapj A𝔄h"
        if "j  𝔍Obj" for j
        using ε𝔗_𝔉σ'[OF that] that
        by
          (
            cs_prems cs_shallow 
              cs_simp: cat_cs_simps cs_intro: adj_cs_intros cat_cs_intros
          )

      show "∃!f'.
        f' : b' 𝔛𝔊ObjMapa  σ' = 𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 f'"
      proof(intro ex1I conjI; (elim conjE)?)
        let ?h' = 𝔊ArrMaph A𝔛ηC ΦNTMapb'
        from h show "?h' : b' 𝔛𝔊ObjMapa"
          by 
            (
              cs_concl cs_shallow 
                cs_intro: cat_cs_intros cat_lim_cs_intros adj_cs_intros
            )
        show "σ' = 𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 ?h'"
        proof(rule ntcf_eqI)
          show "σ' : cf_const 𝔍 𝔛 b' CF 𝔊 CF 𝔗 : 𝔍 ↦↦Cα𝔛"
            by (rule σ'.is_ntcf_axioms)
          then have dom_lhs: "𝒟 (σ'NTMap) = 𝔍Obj" 
            by (cs_concl cs_shallow cs_simp: cat_cs_simps)
          from h show 
            "𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 ?h' : 
              cf_const 𝔍 𝔛 b' CF 𝔊 CF 𝔗 : 𝔍 ↦↦Cα𝔛"
            by
              (
                cs_concl 
                  cs_simp: cat_cs_simps 
                  cs_intro: cat_lim_cs_intros adj_cs_intros cat_cs_intros
              )
          then have dom_rhs:
            "𝒟 ((𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 ?h')NTMap) = 𝔍Obj" 
            by (cs_concl cs_simp: cat_cs_simps)
          show "σ'NTMap = (𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 ?h')NTMap"
          proof(rule vsv_eqI, unfold dom_lhs dom_rhs)
            fix j assume prems': "j  𝔍Obj"
            note [cat_cs_simps] = Φ.L.cat_assoc_helper
              [
                  where h=𝔊ArrMapτNTMapj 
                    and g=𝔊ArrMaph 
                    and f=ηC ΦNTMapb'
                    and q=𝔊ArrMapτNTMapj A𝔄h
              ]
            from prems' h have [cat_cs_simps]: 
              "𝔊ArrMapτNTMapj A𝔄h A𝔛ηC ΦNTMapb' = σ'NTMapj"
              by 
                (
                  cs_concl cs_shallow 
                    cs_simp: cat_cs_simps ε𝔗_𝔉σ[OF prems', symmetric] 
                    cs_intro: adj_cs_intros cat_cs_intros
                )
            from prems' h show 
              "σ'NTMapj = (𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 ?h')NTMapj"
              by 
                (
                  cs_concl 
                    cs_simp: cat_cs_simps  
                    cs_intro: cat_lim_cs_intros adj_cs_intros cat_cs_intros
                )
          qed (cs_concl cs_intro: V_cs_intros cat_cs_intros)+
        qed simp_all

        fix f' assume prems':
          "f' : b' 𝔛𝔊ObjMapa"
          "σ' = 𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 f'"

        from prems'(2) have σ'_j_def':
          "σ'NTMapj = (𝔊 CF-NTCF τ NTCF ntcf_const 𝔍 𝔛 f')NTMapj"
          for j
          by simp
        have σ'_j_def: "σ'NTMapj = 𝔊ArrMapτNTMapj A𝔛f'" 
          if "j  𝔍Obj" for j
          using σ'_j_def'[of j] that prems'(1)
          by
            (
              cs_prems 
                cs_simp: cat_cs_simps cs_intro: cat_lim_cs_intros cat_cs_intros
            )

        from prems'(1) have εa_𝔉f':
          "εC ΦNTMapa A𝔄𝔉ArrMapf' : 𝔉ObjMapb' 𝔄a"
          by (cs_concl cs_intro: cat_lim_cs_intros cat_cs_intros adj_cs_intros)

        interpret ε: is_ntcf α 𝔄 𝔄 𝔉 CF 𝔊 cf_id 𝔄 εC Φ
          by (rule Φ.cf_adjunction_counit_is_ntcf)

        have 
          "(εC Φ NTCF-CF 𝔗 NTCF (𝔉 CF-NTCF σ'))NTMapj =
            τNTMapj A𝔄(εC ΦNTMapa A𝔄𝔉ArrMapf')"
          if "j  𝔍Obj" for j
        proof-
          from that have "τNTMapj : a 𝔄𝔗ObjMapj"
            by 
              (
                cs_concl cs_shallow 
                  cs_simp: cat_cs_simps cs_intro: cat_cs_intros
              )
          from ε.ntcf_Comp_commute[OF this] that have [cat_cs_simps]:
            "εC ΦNTMap𝔗ObjMapj A𝔄𝔉ArrMap𝔊ArrMapτNTMapj =
              τNTMapj A𝔄εC ΦNTMapa"
            by 
              (
                cs_prems cs_shallow 
                  cs_simp: cat_cs_simps cs_intro: cat_cs_intros
              )
          note [cat_cs_simps] = Φ.R.cat_assoc_helper
            [
              where h=εC ΦNTMap𝔗ObjMapj 
                and g=𝔉ArrMap𝔊ArrMapτNTMapj
                and q=τNTMapj A𝔄εC ΦNTMapa
            ]
          show ?thesis
          using that prems'(1)
            by
              (
                cs_concl
                  cs_simp: cat_cs_simps σ'_j_def
                  cs_intro: cat_lim_cs_intros cat_cs_intros adj_cs_intros
              )
        qed
        from h_unique[OF εa_𝔉f' this] have 
          "𝔊ArrMapεC ΦNTMapa A𝔄𝔉ArrMapf' A𝔛ηC ΦNTMapb' = ?h'"
          by simp
        from this prems'(1) show "f' = 𝔊ArrMaph A𝔛ηC ΦNTMapb'"
          by
            (
              cs_prems 
                cs_simp: cat_cs_simps Φ.cf_adj_counit_unit_app 
                cs_intro: cat_lim_cs_intros cat_cs_intros
            )
      qed

    qed

  qed

qed

text‹\newpage›

end