| 1 |
Set Implicit Arguments. |
| 2 |
Set Universe Polymorphism. |
| 3 |
|
| 4 |
Module success. |
| 5 |
Unset Primitive Projections. |
| 6 |
|
| 7 |
Record category := |
| 8 |
{ ob : Type; |
| 9 |
hom : ob -> ob -> Type; |
| 10 |
comp : forall x y z, hom y z -> hom x y -> hom x z }. |
| 11 |
|
| 12 |
Delimit Scope hom_scope with hom. |
| 13 |
Bind Scope hom_scope with hom. |
| 14 |
Arguments hom : clear implicits. |
| 15 |
Arguments comp _ _ _ _ _%_hom _%_hom : clear implicits. |
| 16 |
|
| 17 |
Notation "f 'o' g" := (comp _ _ _ _ f g) (at level 40, left associativity) : hom_scope. |
| 18 |
|
| 19 |
Record functor (C D : category) := |
| 20 |
{ ob_of : ob C -> ob D; |
| 21 |
hom_of : forall x y, hom C x y -> hom D (ob_of x) (ob_of y) }. |
| 22 |
|
| 23 |
Delimit Scope functor_scope with functor. |
| 24 |
Bind Scope functor_scope with functor. |
| 25 |
|
| 26 |
Arguments hom_of _ _ _%_functor _ _ _%_hom. |
| 27 |
|
| 28 |
Notation "F '_1' m" := (hom_of F _ _ m) (at level 10, no associativity) : hom_scope. |
| 29 |
|
| 30 |
Axiom f_comp : forall C D E, functor D E -> functor C D -> functor C E. |
| 31 |
Notation "f 'o' g" := (@f_comp _ _ _ f g) (at level 40, left associativity) : functor_scope. |
| 32 |
|
| 33 |
Check ((_ o _) _1 _)%hom. (* ((?16 o ?17) _1 ?20)%hom |
| 34 |
: hom ?15 (ob_of (?16 o ?17) ?18) (ob_of (?16 o ?17) ?19) *) |
| 35 |
End success. |
| 36 |
|
| 37 |
Module failure. |
| 38 |
Set Primitive Projections. |
| 39 |
|
| 40 |
Record category := |
| 41 |
{ ob : Type; |
| 42 |
hom : ob -> ob -> Type; |
| 43 |
comp : forall x y z, hom y z -> hom x y -> hom x z }. |
| 44 |
|
| 45 |
Delimit Scope hom_scope with hom. |
| 46 |
Bind Scope hom_scope with hom. |
| 47 |
Arguments hom : clear implicits. |
| 48 |
Arguments comp _ _ _ _ _%_hom _%_hom : clear implicits. |
| 49 |
|
| 50 |
Notation "f 'o' g" := (comp _ _ _ _ f g) (at level 40, left associativity) : hom_scope. |
| 51 |
|
| 52 |
Record functor (C D : category) := |
| 53 |
{ ob_of : ob C -> ob D; |
| 54 |
hom_of : forall x y, hom C x y -> hom D (ob_of x) (ob_of y) }. |
| 55 |
|
| 56 |
Delimit Scope functor_scope with functor. |
| 57 |
Bind Scope functor_scope with functor. |
| 58 |
|
| 59 |
Arguments hom_of _ _ _%_functor _ _ _%_hom. |
| 60 |
|
| 61 |
Notation "F '_1' m" := (hom_of F _ _ m) (at level 10, no associativity) : hom_scope. |
| 62 |
Notation "F '_2' m" := (hom_of F%functor _ _ m) (at level 10, no associativity) : hom_scope. |
| 63 |
|
| 64 |
Axiom f_comp : forall C D E, functor D E -> functor C D -> functor C E. |
| 65 |
Notation "f 'o' g" := (@f_comp _ _ _ f g) (at level 40, left associativity) : functor_scope. |
| 66 |
|
| 67 |
Check ((_ o _) _2 _)%hom. (* ((?14 o ?15)%functor _1 ?18)%hom |
| 68 |
: hom ?13 (ob_of (?14 o ?15)%functor ?16) |
| 69 |
(ob_of (?14 o ?15)%functor ?17) *) |
| 70 |
Check ((_ o _) _1 _)%hom. (* Toplevel input, characters 7-19: |
| 71 |
Error: |
| 72 |
The term "(?23 o ?24)%hom" has type "hom ?19 ?20 ?22" |
| 73 |
while it is expected to have type "functor ?25 ?26". *) |
| 74 |
End failure. |