perga/examples/category.pg
2024-12-08 19:37:56 -08:00

37 lines
1.3 KiB
Text

@include logic.pg
section Category
variable
(Obj : *)
(Hom : Obj -> Obj -> *)
(id : forall (A : Obj), Hom A A)
(comp : forall (A B C : Obj), Hom A B -> Hom B C -> Hom A C);
hypothesis
(id_l : forall (A B : Obj) (f : Hom A B), eq (Hom A B) (comp A A B (id A) f) f)
(id_r : forall (A B : Obj) (f : Hom B A), eq (Hom A B) (comp B A A f (id A)) f)
(assoc : forall (A B C D : Obj) (f : Hom A B) (g : Hom B C) (h : Hom C D),
eq (Hom A D)
(comp A B D f (comp B C D g h))
(comp A C D (comp A B C f g) h));
def initial (A : Obj) := forall (B : Obj), exists_uniq (Hom A B) (fun (f : Hom A B) => true);
def terminal (A : Obj) := forall (B : Obj), exists_uniq (Hom B A) (fun (f : Hom B A) => true);
section Inverses
variable
(A B : Obj)
(f : Hom A B)
(g : Hom B A);
def inv_l := eq (Hom A A) (comp A B A f g) (id A);
def inv_r := eq (Hom B B) (comp B A B g f) (id B);
def inv := and inv_l inv_r;
end Inverses
def isomorphic (A B : Obj) :=
exists (Hom A B) (fun (f : Hom A B) =>
exists (Hom B A) (fun (g : Hom B A) =>
inv A B f g));
end Category