1 Require Import Morphisms.
2 Require Import RelationClasses.
3 Require Import Equivalence.
7 Require Import interfaces.abstract_algebra.
11 Context
`(Category L) `(Category R).
19 Definition
Arrow (x y
: Object
) : Type
:= match x
, y with
20 | inl l
, inl r
=> l ⟶ r
21 | inr l
, inr r
=> l ⟶ r
24 | cross
, cross
=> unit
28 Global Instance
: Arrows Object
:= Arrow.
29 Hint Extern
4 (Arrows Object
) => exact Arrow
: typclasses_instance.
32 Section more_arrows.
Context (x y
: Object
).
33 Global Instance e
: Equiv (x ⟶ y
) :=
35 | inl l
, inl r
=> fun f g
: l ⟶ r
=> f
= g
36 | inr l
, inr r
=> fun f g
: l ⟶ r
=> f
= g
37 | _
, _
=> fun _ _
=> True
40 Let e_refl
: Reflexive e.
44 destruct x
, y
; reflexivity.
47 Let e_sym
: Symmetric e.
52 destruct x
, y
; try symmetry
; trivial.
55 Let e_trans
: Transitive e.
58 intros f g h . unfold e.
59 destruct x
, y
; try transitivity g
; trivial.
61 Instance
: Equivalence e.
62 Global Instance
: Setoid (x⟶y
).
65 Global Instance
: CatId Object.
67 intro x
; destruct x
; compute
; exact cat_id || exact tt.
70 Global Instance
: CatComp Object.
71 intros x y z
; destruct x
, y
, z
; compute
; trivial
;
72 try contradiction
; apply comp.
75 Let id_l
' (x y
: Object
) (f
: x ⟶ y
): cat_id ◎ f
= f.
77 destruct x
, y
; compute
; trivial
; apply id_l.
79 Let id_r
' (x y
: Object
) (f
: x ⟶ y
): f ◎ cat_id
= f.
81 destruct x
, y
; compute
; trivial
; apply id_r.
85 Context (w x y z
: Object
) (a
: w ⟶ x
) (b
: x ⟶ y
) (c
: y ⟶ z
).
86 Lemma comp_assoc
': c ◎
(b ◎ a
) = (c ◎ b
) ◎ a.
88 destruct w
, x
, y
, z
; compute
; trivial
; try contradiction
; apply comp_assoc.
92 Global Instance
: forall x y z
: Object
, Proper (equiv
==> equiv
==> equiv
)
93 ((◎
) : (y ⟶ z
) -> (x ⟶ y
) -> (x ⟶ z
)).
95 intros x y z
; destruct x
, y
, z
; compute
; trivial
; try contradiction
; [apply H0 | apply H2
].
98 Global Instance
: Category Object
:= { comp_assoc
:= comp_assoc
'; id_l
:= id_l
'; id_r
:= id_r
'}.