Section cat.
Variables (Ob : Type) (Hom : Ob -> Ob -> Setoid).
Infix "-->" := Hom (at level 95, right associativity).
Variable Op_comp : forall a b c : Ob, Map2 (a --> b) (b --> c) (a --> c).
Definition Cat_comp (a b c : Ob) (f : a --> b) (g : b --> c) :=
Op_comp a b c f g.
Infix "o" := Cat_comp (at level 20, right associativity).
Definition Assoc_law :=
forall (a b c d : Ob) (f : a --> b) (g : b --> c) (h : c --> d),
f o g o h =_S (f o g) o h.
Variable Id : forall a : Ob, a --> a.
Definition Idl_law := forall (a b : Ob) (f : a --> b), Id _ o f =_S f.
Definition Idr_law := forall (a b : Ob) (f : b --> a), f =_S f o Id _.
End cat.
Structure Category : Type :=
{Ob :> Type;
Hom : Ob -> Ob -> Setoid;
Op_comp : forall a b c : Ob, Map2 (Hom a b) (Hom b c) (Hom a c);
Id : forall a : Ob, Hom a a;
Prf_ass : Assoc_law Op_comp;
Prf_idl : Idl_law Op_comp Id;
Prf_idr : Idr_law Op_comp Id}.
(* Projections *)
Definition Comp (C : Category) := Cat_comp (Op_comp (c:=C)).
Infix "-->" := Hom (at level 95, right associativity).
Infix "o" := Comp (at level 20, right associativity).
(*** rewrite rules ***)

Lemma Idr1 : forall (C : Category) (a b : C) (f : a --> b), f o Id _ =_S f.