Definition Comma : Category :=
{|
Obj := Comma_Obj;
Hom := Comma_Hom;
compose := @Comma_Hom_compose;
assoc := @Comma_Hom_compose_assoc;
assoc_sym := fun _ _ _ _ f g h => eq_sym (Comma_Hom_compose_assoc f g h);
id := Comma_Hom_id;
id_unit_right := @Comma_Hom_id_unit_right;
id_unit_left := @Comma_Hom_id_unit_left
|}.
End Comma.
Arguments CMO_src {_ _ _ _ _} _.
Arguments CMO_trg {_ _ _ _ _} _.
Arguments CMO_hom {_ _ _ _ _} _.
Arguments CMH_left {_ _ _ _ _ _ _} _.
Arguments CMH_right {_ _ _ _ _ _ _} _.
Arguments CMH_com {_ _ _ _ _ _ _} _.
(** In this section we show that the opposite the comma category of (Comma F G) is isomorphic to the comma category (Comma Gᵒᵖ Fᵒᵖ). *)
Section Comma_Opposite_Iso.
Context {B C D : Category} (F : (B –≻ C)%functor) (G : (D –≻ C)%functor).
Local Hint Extern 1 => progress cbn.
Local Hint Extern 1 => apply Comma_Hom_eq_simplify.
Program Definition Comma_Opposite_Iso_LR :
Functor ((Comma F G)^op) (Comma (G ^op) (F ^op))
:=
{|
FO :=
fun x =>
{|
CMO_src := CMO_trg x;
CMO_trg := CMO_src x;
CMO_hom := CMO_hom x
|};
FA :=
fun c c' h =>
{|
CMH_left := CMH_right h;
CMH_right := CMH_left h;
CMH_com := eq_sym (CMH_com h)
|}
|}.
Program Definition Comma_Opposite_Iso_RL :
Functor (Comma (G ^op) (F ^op)) ((Comma F G)^op)
:=
{|
FO :=
fun x =>
{|
CMO_src := CMO_trg x;
CMO_trg := CMO_src x;
CMO_hom := CMO_hom x
|};
FA :=
fun c c' h =>
{|
CMH_left := CMH_right h;
CMH_right := CMH_left h;
CMH_com := eq_sym (CMH_com h)
|}
|}.
Program Definition Comma_Opposite_Iso :
(((Comma F G)^op)%category ≃≃ Comma (G ^op) (F ^op) ::> Cat)%isomorphism
:=
{|
iso_morphism := Comma_Opposite_Iso_LR;
inverse_morphism := Comma_Opposite_Iso_RL
|}
.
End Comma_Opposite_Iso.
(** In this section we show that whenever F and F' are two naturally isomorphic functors, then (Comma F G) is isomorphic to (Comma F' G). *)
Section Comma_Left_Func_Iso.
Context {B C D : Category}.
Local Hint Extern 1 => progress cbn.
Local Hint Extern 1 => apply Comma_Hom_eq_simplify.
Section Comma_Left_Func_Iso_FC.
Context
{F F' : (B –≻ C)%functor}
(I : (F ≃ F')%natiso)
(G : (D –≻ C)%functor)
.
(** Given a natural isomorphism we build a functor. *)
Program Definition Comma_Left_Func_Iso_FC :
Functor (Comma F G) (Comma F' G)
:=
{|
FO :=
fun x =>
{|
CMO_src := CMO_src x;
CMO_trg := CMO_trg x;
CMO_hom := (CMO_hom x) ∘ (Trans (inverse_morphism I) (CMO_src x))
|};
FA :=
fun c c' h =>
{|
CMH_left := CMH_left h;
CMH_right := CMH_right h;
CMH_com := _
|}
|}.
Next Obligation.
End Comma_Left_Func_Iso_FC.
Section Comma_Left_Func_Iso_FC_Iso.
Context
{F F' : (B –≻ C)%functor}
(I : (F ≃ F')%natiso)
(G : (D –≻ C)%functor)
.

(** Functors produced from a natural isomorphism and its inverse are inverses. *)
Lemma Comma_Left_Func_Iso_FC_Iso :
((Comma_Left_Func_Iso_FC I G)
∘
(Comma_Left_Func_Iso_FC (Inverse_Isomorphism I) G))%functor
=
Functor_id _
.