NatTrans.NatIso.
Local Open Scope isomorphism_scope.
Local Open Scope morphism_scope.
Local Open Scope object_scope.
(** If two categories are isomorphic, then so are their duals. *)
Section Opposite_Cat_Iso.
Context {C D : Category} (I : C ≃≃ D ::> Cat).
Program Definition Opposite_Cat_Iso :
(C^op)%category ≃≃ (D^op)%category ::> Cat
:=
{|
iso_morphism := ((iso_morphism I)^op)%functor;
inverse_morphism := ((inverse_morphism I)^op)%functor
|}.
Next Obligation.
change (I ⁻¹ ^op ∘ (iso_morphism I) ^op)%functor
with (((inverse_morphism I) ∘ (iso_morphism I))^op)%functor.
cbn_rewrite (left_inverse I).
trivial.
Qed.
Next Obligation.
change ((iso_morphism I) ^op ∘ I ⁻¹ ^op)%functor
with (((iso_morphism I) ∘ (inverse_morphism I))^op)%functor.
cbn_rewrite (right_inverse I).
trivial.
Qed.
End Opposite_Cat_Iso.
(** Conversion from a category to another isomorphic category. *)
Section Cat_IConv.
Context {C D : Category} (I : C ≃≃ D ::> Cat).
(** Object conversion through an isomorphism and its inverse isomorphism gives back the same object. *)
Definition Cat_Iso_Obj_conv (c : C) :
c = (((inverse_morphism I) _o) (((iso_morphism I) _o) c))%object.
(** Homomorphism types remain the smae after object conversion through an isomorphism and its inverse isomorphism. *)
Definition Cat_Iso_Hom_conv (c c' : C) :
((((inverse_morphism I) _o) (((iso_morphism I) _o) c))
–≻
(((inverse_morphism I) _o) (((iso_morphism I) _o) c')))%morphism
= (c –≻ c').
(** Type conversion to the original hom type after conversion with the inverse of an isomorphism and that isomorphism. *)
Definition Cat_Iso_conv {c c' : C} (h : c –≻ c') :
(((inverse_morphism I) _o) (((iso_morphism I) _o) c))
–≻ (((inverse_morphism I) _o) (((iso_morphism I) _o) c'))
:=
match eq_sym (Cat_Iso_Hom_conv c c') in _ = Y return Y with
eq_refl => h
end.

(* Specifications: *)
(** Heterogenous equality of type conversion to the original hom type after conversion with the inverse of an isomorphism and that isomorphism. *)
Theorem Cat_Iso_conv_JMeq {c c' : C} (h : c –≻ c') : Cat_Iso_conv h ~= h.
(** Conversion once through an isomrphism and its inverse and once through its inverse and it gives back the same arrow as we strated with. *)
Theorem Cat_Iso_conv_inv_Cat_Iso_conv {c c' : C} (h : c –≻ c')
: Cat_Iso_conv_inv (Cat_Iso_conv h) = h.
(** Conversion once through the inverse of an isomrphism and that isomorphism and once through that isomorphism and its inverse gives back the same arrow as we strated with. *)
Theorem Cat_Iso_conv_Cat_Iso_conv_inv {c c' : C}
(h :
(((inverse_morphism I) _o) (((iso_morphism I) _o) c))
–≻ (((inverse_morphism I) _o) (((iso_morphism I) _o) c')))
:
Cat_Iso_conv (Cat_Iso_conv_inv h) = h.
(** Conversion of an arrow through an isomorphism and its inverse (after correcting the homorphism type) is the same arrow as we started with. *)
Theorem Cat_Iso_conv_inv_I_inv_I {c c' : C} (h : c –≻ c') :
Cat_Iso_conv_inv (((inverse_morphism I) _a) (((iso_morphism I) _a) h)) = h.
(** Morphism composition commutes with conversion. *)
Theorem Cat_Iso_conv_inv_compose {c c' c'' : C}
(h :
(((inverse_morphism I) _o) (((iso_morphism I) _o) c))
–≻ (((inverse_morphism I) _o) (((iso_morphism I) _o) c'))
)
(h' :
(((inverse_morphism I) _o) (((iso_morphism I) _o) c'))
–≻ (((inverse_morphism I) _o) (((iso_morphism I) _o) c''))
)
:
Cat_Iso_conv_inv (compose C h h')
= compose C (Cat_Iso_conv_inv h) (Cat_Iso_conv_inv h').