Class Category : Type :=
{
Obj : Type;
Hom : Obj -> Obj -> Type;
compose : forall {a b c : Obj}, (Hom a b) -> (Hom b c) -> (Hom a c);
id : forall {a : Obj}, Hom a a;
}.
Definition CoAlgebra (T : Functor C C) :=
@Algebra (Opposite C) (Opposite_Functor T).
Definition CoAlgebra_Hom {T : Functor C C} :=
@Algebra_Hom (Opposite C) (Opposite_Functor T).
Definition CoAlgebra_Hom_id {T : Functor C C} :=
@Algebra_Hom_id (Opposite C) (Opposite_Functor T).
Definition CoAlgebra_Cat (T : Functor C C) :=
@Algebra_Cat (Opposite C) (Opposite_Functor T).
End CoAlgebras.
ProgramDefinition Type_Cat : Category :=
{|
Obj := Type;
Hom := (fun A B => A -> B);
compose := fun A B C (g : A -> B) (h : B -> C) => fun (x : A) => h (g x);
id := fun A => fun x => x
|}.
Local Obligation Tactic := idtac.
ProgramDefinition Prod_Cat (C C' : Category) : Category :=
{|
Obj := C * C';
Hom := fun a b =>
((Hom (fst a) (fst b)) * (Hom (snd a) (snd b)))%type;
compose := fun a b c f g =>
((compose (fst f) (fst g)), (compose (snd f)(snd g)));
id := fun c => (id, id)
|}.
Class Terminal (C : Category) : Type :=
{
terminal : C;
t_morph : forall (d : Obj), Hom d terminal;
t_morph_unique : forall (d : Obj) (f g : (Hom d terminal)), f = g
}.
Record Product {C : Category} (c d : C) : Type :=
{
product : C;
Pi_1 : Hom product c;
Pi_2 : Hom product d;
Prod_morph_ex : forall (p' : Obj) (r1 : Hom p' c) (r2 : Hom p' d), (Hom p' product);
}.
Definition Has_Products (C : Category) : Type := forall a b, Product a b.
Existing Class Has_Products.
ProgramDefinition Prod_Func (C : Category) {HP : Has_Products C}
: Functor (Prod_Cat C C) C :=
{|
FO := fun x => HP (fst x) (snd x);
FA := fun a b f => Prod_morph_ex _ _ (compose Pi_1 (fst f)) (compose Pi_2 (snd f))
|}.
Arguments Prod_Func _ _, _ {_}.
Definition Sum (C : Category) := @Product (Opposite C).
Arguments Sum _ _ _, {_} _ _.
Definition Has_Sums (C : Category) : Type := forall (a b : C), (Sum a b).
Existing Class Has_Sums.
ProgramDefinition sum_Sum (A B : Type) : (@Sum Type_Cat A B) :=
{|
product := (A + B)%type;
Prod_morph_ex := fun (p' : Type)
(r1 : A -> p')
(r2 : B -> p')
(X : A + B) => match X return p' with
| inl a => r1 a
| inr b => r2 b end
|}.
Next Obligation. simpl; auto. Defined.
Next Obligation. simpl; auto. Defined.
ProgramDefinition term_id : Functor Type_Cat (Prod_Cat Type_Cat Type_Cat) :=
{|
FO := fun a => (@terminal Type_Cat _, a);
FA := fun a b f => (@id _ (@terminal Type_Cat _), f)
|}.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.