(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(*****************************************************************************)
(*          Projet Coq - Calculus of Inductive Constructions V5.10           *)
(*****************************************************************************)
(*                                                                           *)
(*          Categories                                                       *)
(*                                                                           *)
(*          Peter Aczel, Dec. 92                                             *)
(*          rev. Gerard Huet,  Aug. 1993                                     *)
(*          rev. Amokrane Saibi,  May 1994                                   *)
(*                                                                           *)
(*****************************************************************************)
Require Export Map2.
Set Implicit Arguments.
Unset Strict Implicit.
(*  The type of categories *)
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.