[Posting in Misc since this is more of a mathematics question than a Rocq-specific question.]
This is an excerpt of a development of a “theory of categories”, where I get stuck at defining the category of categories, aka the category Cat.
What (minimal, possibly) axiom/principle am I missing here to prove the needed properties? (E.g. I cannot think of any extensionality axiom that would help here.)
Set Implicit Arguments.
Unset Strict Implicit.
Unset Strongly Strict Implicit.
Unset Contextual Implicit.
Unset Reversible Pattern Implicit.
Unset Printing Implicit Defensive.
Set Universe Polymorphism.
Set Polymorphic Inductive Cumulativity.
Set Cumulativity Weak Constraints.
Unset Universe Minimization ToSet.
From Coq Require Import Program.
(** The type of "categories". *)
Structure Cat@{i o} : Type@{o} :=
mkCat {
Ob : Type@{i};
Hom : Ob -> Ob -> Type@{i};
ident : forall x,
Hom x x;
comp : forall x y z, (* diagrammatic *)
Hom x y ->
Hom y z ->
Hom x z;
comp_unitL : forall x y,
forall (f : Hom x y),
comp (ident x) f = f;
comp_unitR : forall x y,
forall (f : Hom x y),
comp f (ident y) = f;
comp_assoc : forall w x y z,
forall (f : Hom w x),
forall (g : Hom x y),
forall (h : Hom y z),
comp f (comp g h) = comp (comp f g) h;
} as C.
Arguments Hom : clear implicits.
(** The type of "functors" from [B] to [C]. *)
Structure Fun@{i o} (B C : Cat@{i o}) : Type@{o} :=
mkFun {
fOb : Ob B -> Ob C;
fHom : forall x y,
Hom B x y -> Hom C (fOb x) (fOb y);
fident_prop : forall x,
fHom (ident x) = ident (fOb x);
fcomp_prop : forall x y z,
forall (f : Hom B x y),
forall (g : Hom B y z),
fHom (comp f g) = comp (fHom f) (fHom g);
} as F.
(** Constructs the "identity functor" at [C]. *)
Definition mkFunIdent@{i o} C : Fun@{i o} C C :=
{|
fOb x := x;
fHom _ _ f := f;
fident_prop _ := eq_refl;
fcomp_prop _ _ _ _ _ := eq_refl;
|}.
(** Constructs the "functor composition" [F] then [G]. *)
Program Definition mkFunComp@{i o} A B C :
forall (F : Fun A B) (G : Fun B C), Fun@{i o} A C :=
fun F G => {|
fOb x := fOb G (fOb F x);
fHom _ _ f := fHom G (fHom F f);
|}.
Next Obligation. (* fident_prop *)
rewrite 2 fident_prop. reflexivity.
Defined.
Next Obligation. (* fcomp_prop *)
rewrite 2 fcomp_prop. reflexivity.
Defined.
(** Constructs the "category Cat" of cats and functors. *)
Program Definition mkCatCat@{i n o} : Cat@{n o} :=
{|
Ob := Cat@{i n};
Hom B C := Fun@{i n} B C;
ident C := mkFunIdent C;
comp _ _ _ F G := mkFunComp F G;
|}.
Next Obligation. (* comp_unitL *)
rename x into B, y into C, f into F.
unfold mkFunComp; cbn.
unfold mkFunComp_obligation_1;
unfold mkFunComp_obligation_2; cbn.
destruct F; cbn.
(* These are immediate by eta-expansion *)
change (fOb0) with (fun x => fOb0 x) at 30.
change (fHom0) with (fun x y f => fHom0 x y f) at 10.
(* But what then? *)
(Please don’t mind too much my use of universes: I am still finding my way. But if you have any suggestions to improve on that or other, you are indeed welcome.)