RSS

Cat­e­gory theory

TagLast edit: 19 Feb 2025 3:18 UTC by RobertM

Category theory studies the abstraction of mathematical objects (such as sets, groups, and topological spaces) in terms of the morphisms between them. Such a collection of objects and morphisms is a category. Morphisms often represent functions. For example, in the category of sets, morphisms represent all functions, in the category of groups they represent group homomorphism and in the category of topological spaces, they represent continuous maps.

Categories are usually drawn as diagrams with the objects represented by variables or points with (labeled) arrows between them representing morphisms. For this reason, morphisms are also referred to as arrows.

Morphisms do not have to represent functions. For example, any partially ordered set may be seen as a category where the objects are the elements of the poset and there is a (unique) morphism between two elements and if and only if .

Definition

A category consists of a collection of objects and a collection of morphisms. A morphism goes from one object, say , to another, say , and is drawn as an arrow from to . Note that may equal (in which case is referred to as an endomorphism). The object is called the source or domain of and is called the target or codomain of . This is written as .

These morphisms must satisfy three conditions:

  1. Composition: For any two morphisms and , there exists a morphism , written as or simply .

  2. Associativity: For any morphisms , and composition is associative, i.e., .

  3. Identity: For any object , there is a (unique) morphism, which, when composed with another morphism, leaves it unchanged. I.e., given and it holds that: and .

Note that composition is written ‘backwards’ since given an element and two functions and , the result of applying then is which equals .

Motivation

Many mathematical constructions (such as products) appear across different fields of mathematics, consisting of different ingredients but nevertheless capturing a similar idea (and often even under the same name). Category theory allows one to precisely describe the property that these different constructions all at once. This allows one to prove theorems about all these structures at once. Hence, once you prove that a specific mathematical structure is, say, a product, then all the category-theoretic theorems about products are true for that structure. In fact, sometimes there are structures which non-obviously satisfy a category-theoretic property. Especially when category-theoretic duality is involved.

In addition, category theory allows the simple description of functors, natural transformations and adjunctions. These are mathematically powerful concepts which are very difficult to describe without the language of category theory. In fact, one of the founders of category theory, Saunders Mac Lane, has remarked that category theory was initially developed in order to provide a language in which to speak about natural transformations.

Powerfully, functors and adjunctions between categories allow one to translate concepts from one mathematical theory to another. They provide a “translation” (either full or partial) that allows one type of object to be viewed as another, and theorems to be translated across domains. In fact, using duality, very non-obvious translations can be found because a theorem in one category can be translated to its “opposite theory” in the other category. Connections which are not obvious in the language of the mathematical theories themselves, become clear in the language of category theory.

Categories Give an External View

Although the objects and morphisms of a category are intended to represent e.g. sets and functions, from the point of view of the category the objects and morphisms have no internal structure. It is not possible to talk directly about the elements of an object or how a given morphism maps elements. Instead (from the viewpoint of the category) the information about the objects and morphisms are given completely by which objects are sources and targets for the morphisms and how the morphisms are composed.

In fact, this is the strength of category theory: abstracting away the internal details allows one to focus only on relevant information and also capture information about multiple similar types of structures that act in a certain way across different mathematical theories.

This is similar to the way that a group abstracts away what elements are whilst only capturing the information of how they are ‘added’ or ‘multiplied’.

It is also somewhat similar to the concept of a program’s API (or an interface in Java); we can’t see inside the program or know how it implements something, but we know what kind of inputs and outputs programs have, and what kinds of inputs and outputs a composition of such programs have.

Note that since it abstracts something away, a category does not always capture enough information for one’s purposes. For example, there is addition of group homomorphisms defined pointwise. For this purpose, other structures such as enriched categories and n-categories may be used. However, for many purposes, categories are at a very good between isomorphic objects. This is considered a feature of category theory.

Common Symbols: Convention

Different texts make use of different conventions. This site makes use of the following common convention:

These conventions are merely guidelines and far from universally followed. Check the definition for the symbol in question to see what it represents

Isomorphisms in Category Theory

In category theory, isomorphic objects are not distinguished. Many universal_constructions do not pin down a specific construction but instead only specify it up to isomorphism.

Doing something in category theory which relies on a specific construction (instead of being up to isomorphism) is colloquially referred to as evil.

Universal Properties

One of the most important concepts in category theory is that of a universal property. An object in a category which satisfies a universal property is in a sense the ‘best’ (often meaning smallest or largest) object satisfying a certain property. This can often be used to describe in a universal way constructions like products which are defined for multiple distinct structures. In category theory, it is defined once without referring to a specific construction. This definition can then be applied to multiple categories.

The simplest non-trivial universal construction is the terminal object. Given a category , an object in is called a terminal object if, for any object in , there is a unique morphism . In other words there is some and if there is also then . In the category of sets, the terminal objects are exactly the one element sets. Given a one element set , and any set , there is a unique morphism , namely the function taking every in to . In the category of groups, terminal objects are exactly one-element groups. Note that terminal objects need not exist. Consider a poset seen as a category. If it has a largest element , then each object is less than or equal to . So from each object there is a unique morphism to and hence it is terminal. If, however, there is no largest element then the category has no terminal object.

As another example, products can be defined by a universal property: Given a pair of objects and , an object along with a pair of morphisms and is called the product of and if, given any other object and morphisms and there is a unique morphism such that and .

The above are both special cases of a very important and more general universal construction: the limit. This (along with the colimit) is described in more detail further below.

Duality

For any notion in a category, its dual is obtained by `reversing all the arrows’ and ‘reversing the order of composition’. If a statement is true in any category, then its dual is true in any category. As a corollary, if a statement is true in some categories, its dual is true in the duals of those categories.

As an example, consider the definition of a terminal object given above. A statement about terminal object is that any two terminal objects are isomorphic. Let’s examine the exact statement. Assume is terminal. Then for any there is unique . If we reverse the arrows, we get that for every there is unique . This is the definition of an initial object. Consider another terminal object . The statement that is isomorphic to is means that there is some and such that and . The dual of this is just the statement that there is some and such that and , this is exactly the same property! (The morphisms and have just been renamed). Hence, the dual of the statement that a terminal object is unique up to isomorphism is the statement that every initial object is unique up to isomorphism.

Similarly, if something is true for every category with an initial object, its dual will be true for every category with a terminal object.

The concept of duality can be a powerful way of obtaining new results which come easily within category theory, but which are not obvious in the theory to which category theory is being applied. As an advanced example, the category of Boolean Algebras is dual to the category of Stone Spaces. See, Stone Duality on Wikipedia for the motivation.

Add better example(s) of duality

Functors

A functor is a morphism between categories.

Given two categories and , a functor from to , written is defined as a pair of functions:

Which satisfy:

1. Preservation of domain and codomain: If then . ( Put differently, Dom() = (Dom()) and Cod() = (Cod()) for every morphism . )

  1. Preservation of Identity: If the morphism is the identity on , then the morphism is the identity on .

  2. Preservation of composition: Given morphisms and , then the composition of their images is the image of their composition .

Instead of differentiating and , they are usually both written simply as . E.g. .

Properties of Morphisms

Morphisms are the central objects of study in category theory. For this reason, properties of morphisms can be very important. A morphism is called the following if it satisfies the given property:

There exists some such that and .

Intuitively, an isomorphism is a way of transforming from one object to another in a way that makes them indistinguishable using the information of the category.

For any object and morphisms , if then .

Intuitively, being a monomorphism indicates that all of the information captured by the collection of morphisms into is preserved when composing by . It generalizes the notion of an injective function, since in most concrete categories (like sets, groups, and topological spaces) every injective map is a monomorphism. However, even in concrete categories (and certainly more generally), monomorphisms need not be injective.

For any object and morphisms , if then .

Intuitively, being an epimorphism indicates that all the information captured by the collection of morphisms out of is preserved when composing by .. It generalizes the notion of a surjective function. However, in an even stronger sense than for monomorphisms, a function being epimorphic and a function being surjective are far from equivalent.

Properties that more closely match surjectivity include Section /​ Split Epimorphism, and regular epimorphism. strict epimorphism, strong epimorphism, and extremal epimorphism. Note that despite the names, not all of these are necessarily epimorphisms, but are epimorphisms in “nice” categories.

, i.e., .

An endomorphism is a morphism from an object to itself.

The morphism is both an endomorphism and an isomorphism.

An automorphism is a morphism from a structure to itself that preserves all the information of the structure that is distinguishable by the category. Intuitively, it gives “another view” of a structure (say, by moving around its elements) that leaves it essentially unchanged.

There exists some such that

A morphism is a retraction if its effect can be “reversed” or inverted by another morphism applied after it. For example, every injective map is a retraction. The morphism which inverts the retraction is a section.

There exists some such that

A morphism is a section if it “reverses” the effect of some other morphism applied before it. The morphism which is inverted is a retraction.

Limits and Colimits

Further Universal Constructions

Natural Transformations

Constructions on Categories

Adjunctions and Adjoint Functors

Towards Hodge-podge Alignment

Cleo Nardo19 Dec 2022 20:12 UTC
95 points
30 comments9 min readLW link

Cat­e­gory The­ory Without The Baggage

johnswentworth3 Feb 2020 20:03 UTC
139 points
54 comments13 min readLW link

In­tro­duc­tion to In­tro­duc­tion to Cat­e­gory Theory

countedblessings6 Oct 2019 14:43 UTC
114 points
19 comments2 min readLW link

Cat­e­gories: mod­els of models

countedblessings9 Oct 2019 2:45 UTC
53 points
18 comments13 min readLW link

Time com­plex­ity for de­ter­minis­tic string machines

alcatal21 Apr 2024 22:35 UTC
21 points
2 comments21 min readLW link

Biex­ten­sional Equivalence

Scott Garrabrant28 Oct 2020 14:07 UTC
43 points
13 comments10 min readLW link

Mul­ti­plica­tive Oper­a­tions on Carte­sian Frames

Scott Garrabrant3 Nov 2020 19:27 UTC
34 points
24 comments12 min readLW link

CTWTB: Paths of Com­pu­ta­tion State

johnswentworth8 Sep 2020 20:44 UTC
41 points
1 comment4 min readLW link

Ag­grega­tive prin­ci­ples ap­prox­i­mate util­i­tar­ian principles

Cleo Nardo12 Jun 2024 16:27 UTC
28 points
3 comments23 min readLW link

Ag­grega­tive Prin­ci­ples of So­cial Justice

Cleo Nardo5 Jun 2024 13:44 UTC
29 points
10 comments37 min readLW link

Uncer­tainty in all its flavours

Cleo Nardo9 Jan 2024 16:21 UTC
34 points
6 comments35 min readLW link

Ad­di­tive Oper­a­tions on Carte­sian Frames

Scott Garrabrant26 Oct 2020 15:12 UTC
62 points
6 comments11 min readLW link

Carte­sian frames as gen­er­al­ised models

Stuart_Armstrong16 Feb 2021 16:09 UTC
20 points
0 comments5 min readLW link

Ex­am­in­ing Arm­strong’s cat­e­gory of gen­er­al­ized models

Morgan_Rogers10 May 2022 9:07 UTC
14 points
0 comments7 min readLW link

What is cat­e­gory the­ory?

countedblessings6 Oct 2019 14:33 UTC
65 points
6 comments3 min readLW link

Ex­am­ples of Categories

countedblessings10 Oct 2019 1:25 UTC
27 points
2 comments5 min readLW link

Time is ho­mo­ge­neous se­quen­tially-com­pos­able determination

TsviBT8 Oct 2023 14:58 UTC
15 points
0 comments21 min readLW link

Finite Fac­tored Sets to Bayes Nets Part 2

J Bostock3 Feb 2024 12:25 UTC
6 points
0 comments8 min readLW link

Semi-Sim­pli­cial Types, Part I: Mo­ti­va­tion and History

astradiol9 Mar 2024 22:07 UTC
20 points
3 comments10 min readLW link

The sen­tence struc­ture of mathematics

countedblessings7 Oct 2019 18:58 UTC
41 points
15 comments2 min readLW link

Davi­dad’s Bold Plan for Align­ment: An In-Depth Explanation

19 Apr 2023 16:09 UTC
167 points
40 comments21 min readLW link2 reviews

Cat­e­gory-The­o­retic Wan­der­ings into Interpretability

unruly abstractions2 Sep 2025 0:03 UTC
18 points
2 comments1 min readLW link
(www.unrulyabstractions.com)

Gen­er­al­ised mod­els as a category

Stuart_Armstrong16 Feb 2021 16:08 UTC
25 points
9 comments4 min readLW link

Ab­strac­tions as mor­phisms be­tween (co)algebras

Erik Jenner14 Jan 2023 1:51 UTC
17 points
1 comment8 min readLW link

[Question] Why does cat­e­gory the­ory ex­ist?

Ben Pace25 Apr 2019 4:54 UTC
37 points
10 comments1 min readLW link

Roadmap for a col­lab­o­ra­tive pro­to­type of an Open Agency Architecture

Deger Turan10 May 2023 17:41 UTC
31 points
0 comments12 min readLW link

Jonothan Go­rard:The ter­ri­tory is iso­mor­phic to an equiv­alence class of its maps

Daniel C7 Sep 2024 10:04 UTC
20 points
18 comments2 min readLW link
(x.com)

Cat­e­gor­i­cal-mea­sure-the­o­retic ap­proach to op­ti­mal poli­cies tend­ing to seek power

jacek12 Jan 2023 0:32 UTC
31 points
3 comments6 min readLW link