Lably
Skip to content

Category theory

General theory of mathematical structures

  • 10 min read
  • 5 chapters

Related on Lably

Through Computer science, Category (mathematics) and Function composition

Many areas of computer science also rely on category theory, such as functional programming and semantics.

A category is formed by two sorts of objects: the objects of the category, and the morphisms, which relate two objects called the source and the target of the morphism. A morphism is often represented by an arrow from its source to its target (see the figure). Morphisms can be composed if the target of the first morphism equals the source of the second one. Morphism composition has similar properties as function composition (associativity and existence of an identity morphism for each object). Morphisms are often some sort of functions, but this is not always the case. For example, a monoid may be viewed as a category with a single object, whose morphisms are the elements of the monoid.

The second fundamental concept of category theory is the concept of a functor, which plays the role of a morphism between two categories C1 and C2: it maps objects of C1 to objects of C2 and morphisms of C1 to morphisms of C2 in such a way that sources are mapped to sources, and targets are mapped to targets (or, in the case of a contravariant functor, sources are mapped to targets and vice-versa). A third fundamental concept is a natural transformation that may be viewed as a morphism of functors.

Categories, objects, and morphisms

Categories

A category C consists of the following three mathematical entities:

  • A class ob(C), whose elements are called objects;
  • A class hom(C), whose elements are called morphisms or maps or arrows.

    Each morphism f has a source object a and target object b.

    The expression f:a→b would be verbally stated as "f is a morphism from a to b".

    The expression hom(a,b) – alternatively expressed as homC(a,b), mor(a,b), or C(a,b) – denotes the hom-class of all morphisms from a to b.

  • A binary operation ∘, called composition of morphisms, such that for any three objects a, b, and c, we have∘:hom(b,c)×hom(a,b)→hom(a,c)The composition of f:a→b and g:b→c is written as g∘f or gf, governed by two axioms:
    1. Associativity: If f:a→b, g:b→c, and h:c→d then h∘(g∘f)=(h∘g)∘f
    2. Identity: For every object x, there exists a morphism 1x:x→x (also denoted as idx) called the identity morphism for x, such that for every morphism f:a→b, we have1b∘f=f=f∘1a

      From the axioms, it can be proved that there is exactly one identity morphism for every object.

Example

A prototypical example of a category is Set, the category of sets and functions between them. The objects of Set are just sets, and a morphism from a set X to a set Y is a function f : X → Y. The category axioms are satisfied since every set has an identity function, and since composition of functions is associative.

Morphisms

Relations among morphisms (such as fg = h) are often depicted using commutative diagrams, with "points" (corners) representing objects and "arrows" representing morphisms.

Morphisms can have any of the following properties. A morphism f : a → b is:

  • a monomorphism (or monic) if f ∘ g1 = f ∘ g2 implies g1 = g2 for all morphisms g1, g2 : x → a.
  • an epimorphism (or epic) if g1 ∘ f = g2 ∘ f implies g1 = g2 for all morphisms g1, g2 : b → x.
  • a bimorphism if f is both epic and monic.
  • an isomorphism if there exists a morphism g : b → a such that f ∘ g = 1b and g ∘ f = 1a.
  • an endomorphism if a = b. end(a) denotes the class of endomorphisms of a.
  • an automorphism if f is both an endomorphism and an isomorphism. aut(a) denotes the class of automorphisms of a.
  • a retraction if a right inverse of f exists, i.e. if there exists a morphism g : b → a with f ∘ g = 1b.
  • a section if a left inverse of f exists, i.e. if there exists a morphism g : b → a with g ∘ f = 1a.

Every retraction is an epimorphism, and every section is a monomorphism. Furthermore, the following three statements are equivalent:

  • f is a monomorphism and a retraction;
  • f is an epimorphism and a section;
  • f is an isomorphism.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Other