@hackage FiniteCategories0.6.5.1

Finite categories and usual categorical constructions on them.

FiniteCategories

The goal of this project is to represent small finite categories in order to make usual constructions automatically on them (e.g. (co)limits, (co)completion, adjunctions, kan extensions, etc.)

Table of Contents

  1. General Info
  2. Technologies
  3. Installation
  4. Collaboration
  5. Examples

General Info

This package provides tools to create categories at the value level. This is different from the Hask category where types are objects in a category with an infinite number of objects and arrows, here we construct categories where objects and arrows are arbitrary values so that we can change categories during runtime. Each category implements two functions following the category structure axioms : ar which returns arrows between two objects of the category and identity which returns the identity of an object. Each FiniteCategory implements an additional function : ob which returns the objects of the category. Thanks to these functions, we can construct automatically all the usual constructions on the categories (limits and colimits, adjunctions, Yoneda embedding, etc.) Functors are different from usual Functor typeclass, we store functors as mapping between objects and morphisms of two categories which respect the category structure.

This package is also different from the package data-category because we can enumerate objects and arrows in a category. This allows us to construct limit, colimits, adjunctions, etc. automatically for arbitrary finite categories. On the other hand, we loose typecheck at compilation time which ensures that composition is sound in Hask, composition in our package might lead to an error raised during runtime.

See also

See the package FiniteCategoriesGraphViz to export the categories as images created with GraphViz.

Installation

Simply run cabal install FiniteCategories

Collaboration

All contributions are appreciated! Contact me by email for any information.

Usage

If you want to construct small categories by hand, see Math.FiniteCategories.CompositionGraph which allows to construct the free category generated by a graph quotiented by a congruence relation on paths of the graph. The function readCGFile allows to construct a CompositionGraph from a simple file, for example :

A -f-> B -g-> D = A -h-> C -i-> D

is a square category where the two diagonals are identified.

To construct a functor, see Diagram in Math.FiniteCategories.FunctorCategory. You can also use readCGDFile from Math.FiniteCategories.CompositionGraph :

<SRC>
X
Y -1-> Z
</SRC>
<TGT>
A -f-> B -g-> D = A -h-> C -i-> D
</TGT>

X => A
Y -1-> Z => B -g-> D

See Math.Categories.ConeCategory, Math.Functors.Adjunction and Math.Functors.KanExtension for useful functions to construct usual categorical constructions.

Examples

A category exported with graphviz looks like the following image :

Category

A diagram on this category selecting two objects C and D is represented next :

Diagram

A cone on this diagram follows, the apex of the cone is in green, its legs are in yellow and the diagram is in blue :

Cone

The limiting cone is represented below, it is the product of the two objects C and D.

Limit