Maths - Topoi

Topos theory is between set theory and category theory. It allows us to take some nice properties of sets and to generalise them to certain categories with the properties described below.

The internal structure of a topos allows us to look at it in a set-like way and the external structure allows us to look at it in a category-like way.

Internal External
set-like category-like
defined with equations defined with arrows.
The internal structure can see inside the set to the elements diagram substructure

The external structure can be seen from the structure of the sub objects (such as subsets)

In Category Theory

An (elementary) topos is a category that:

This is equivalent to:

Topos and Logic

A logic is defined over a type. So if we have a type, say 'set', then its sub-stucture will correspond to a logic as described below. A different type, say 'POSET', will have a different logic.

Elementary (set) Topos

The main example of a topos is set, in other words an (elementary) topos is a set-like category.

In order to understand sets we need to describe the structure of subsets. We need to define an element of the powerset. There are at least two ways to do this:

One way to define S as a subset of X
(that is: ScontainsX) is to specify an inclusion (or injection map) from S to X.

An injective function is one where no two distinct inputs give the same output.

topos logic
It would not work to have a map in the other direction because elements in S are not uniquely identified with elements in X. topos logic
However we can define a subset with a map going out of X. This maps onto a two point set 2 or {0,1}. Those elements that are in the subset map to 1 and those that are not map to 0. This is called the characteristic function. topos logic
We can complete the diagram by adding an object representing the 'true' element. All elements in S map to it. As we can see, the diagram commutes. topos logic
So, in the general case for sets, we have this diagram which commutes. The diagram is also a pullback. topos logic
The diagram relates the set category to the logic of boolean algebra but without the law of the excluded middle, that is intuitional or constructive logic. topos logic

Alternative Viewpoint

We have two sets, 'A' and 'B', with an arbitrary mapping 'F' between them. We can define a subset of set 'B' by using the predicate 'P'. For every subset of 'B' defined by 'P' there exists a subset of 'A' defined by 'R'. Yoneda set embed
However this does not necessarily work in the other direction. Here is an example of a subset of 'A' which does not map to a subset of 'B'. yoneda set embed issue

So the map 'F' between objects induces a contravarient map between arrows P->R.

See also Yoneda embedding.

Generalisation to Non-sets

We can generalise from elementary topos based on sets to other topoi.

We generalise this to categories that are not sets.

  • X becomes some category and S becomes a sub-category.
  • The injective mapping becomes a monic arrow.
  • The characteristic function then becomes the sub-object classifier.
topos logic

Example - Set

The terminal object for set is the one element set. diagram
The sub-object classifier for set is the two element set. We can call these elements true and false. diagram
The truth object for set is an arrow from 1 to true. diagram

So the sub-object classifier '2' looks like Bool but this is not Boolean logic, it is constructive (intuitionistic) logic as described on the page here.

This is because of the map from 1. There is no way for the diagram to commute via 'f'.


Logic of Set Example

Here we look at the logic of the set example (described on page here) and how this corresponds to the subset structure.

In the diagrams below the dark green represents a subobject of the light green and the dark blue represents a subobject of the light blue. They can be combined in various ways:

and (meet) diagram /\(Ω,Ω) -> Ω
  f t
f f f
t f t
or (join) diagram \/(Ω,Ω) -> Ω
  f t
f f t
t t t
implies   =>(Ω,Ω) -> Ω
  f t
f t t
t f t

Example - Graph

In the set example above the sub-object classifier contains just true and false with the familiar Boolean logic. In the following more complicated examples there are also true and false corresponding to the cases where the subobject is completely in or completely out of the whole object. In addition there may now be other cases which are not but are required to allow the injection map to be valid. A good example of this is a graph category:

The terminal object for graph is one node with a loop. diagram

The sub-object classifier for graph has two nodes and 5 arrows.

For nodes:

  • Is not in subgraph
  • Is in subgraph

For edges:

  • Is in subgraph
  • Not in subgraph but its source and target are.
  • Not in subgraph but its source is.
  • Not in subgraph but its target is.
  • Not in subgraph and neither is its source or target.
The truth object. diagram

As with sets this is constructive (intuitionistic) logic as described on the page here.


Logic of Graph Example

The logic of the nodes is the same as the set example but now we have the edges:

and (meet) diagram /\(Ω,Ω) -> Ω
  f t
f f f
t f t
or (join) diagram \/(Ω,Ω) -> Ω
  f t
f f t
t t t
implies   =>(Ω,Ω) -> Ω
  f t
f t t
t f t

Example - Dynamical Systems

The terminal object for dynamical systems is one node with a loop. diagram

The sub-object classifier for dynamical systems.

'0' represents 'true' all other numbers indicate how many steps before it becomes true.



The truth object.

points to '0' representing true.


All nodes and edges in the subobject go to '0' which represents 'true' all other nodes goto the number which indicates how many steps before it becomes true.


Subobject Classifier

See page here for a non-categorical approach to sub-objects.


If the arrow 'f' is monic (injective) then it maps to a subobject (subset) of 'B'. That is: there is a subobject of B that is isomorphic to A.

The inclusion relation on subobjects is:

In order to define the subobject we must define the monic 'upto equality' which is not in the spirit of category theory. We will go on to define a 'subobject classifier' which defines a subobject, in a much more category theoretic way, by the composition of maps (and also relates the whole subject to logic).

Naming Arrows

In category theory we don't usually identify elements, such as elements of a set, because we only tend to determine things 'upto isomorphism'. The objects in a category are whole 'structures', they don't represent individual elements.

However, there is the possibility to indicate elements indirectly using arrows. For instance, if we want to enter a specific element we can use:


because, in sets, 1 is the single element set so it will indicate an element uniquely.

We can also use naming arrows. An arrow:

f: A->B

Is a subset of a function spacetop left bracketftop right bracket:{0}->BA

top left bracketftop right bracketis called the 'name' of the function.


In the opposite direction there is a correspondence between subsets of B and functions:


This is in the space 2B which corresponds to the powersetpower set(B), that is, all the possible subsets of B.

The characteristic arrow: xf classifies objects of B to determine if they are images of A. This is a pullback square. The object 2 has two values: 0 and 1. We also use the symbol Ω and call the elements 'true' and 'false'. subobject classifier

This means the topos theory is related to logic. (see also 'characteristic function' in number theory).

Example in Set

  Example in set
Set A (blue) is subset of B (red). subobject set
If we take the inverse of f we get the concept of a 'bundle' as discussed on this page. fibre

classifier for set.


subobject set classifier

Predicate Category

The relationship ScontainsX above is a predicate. We can form a category of predicates on sets as follows:


predicates are pairs (S,X) where

X(i) implies an element i∈S is a free variable in S.


(S,X) -> (T,Y) where:

u:S-> T and X(i) implies:


predicate category

See also - Predicate logic.

Family of Sets

A family of sets consists of an index set I and, for each element k of I, a set Sk.

There seems to be two ways to conceptulise this:

Modest Sets

Set theoretic model of polymorphism.

Indexed Categories

(fibred category)

  indexed category


many sorted algebra ∑

Generalisation from Sets to Categories

Here we have illustrated some basic concepts using sets but they can be generalised to categories as shown here:

Sets Categories

Injective Function

No two distinct inputs give the same output.

We can define 'A' a subset of 'B' by using an injective function from C

injective function set

Monic Arrow

Whenever f•g = f•h then g=h


Here we are showing this as an inclusion function because we are interested in subset classifiers.

Injective function f: C >->B determines A as a subset of B (AcontainsB)
Im f = {f(x): x∈C}
where Im = Image

Set inclusion is a partial odering on the Power set


Surjective function

surjective function set

Epic Arrow

Inverse Functions

inverse function set


Power Set

power set

Power Object

subobjects of d form a poset

Topological Space

In many cases the concept of a metric space is unnessary, however we still need the concept of 'nearness' and hence 'continuity'. 'Topological space' based on the 'topological open set' is the most general way we can do this. This allows us to define nearness purely using the concept of a subset.

Hausdorff Space

Hausdorff space is a bit more specific than general topological space. Space is Hausdorff if, in addition to being a topological open set, for any two points:
x1, x2∈X there are disjoint open sets U1, U2 that contain x1and x2.


A basis is a subcollection Bcontains= U


such that evey element of U is a union of open sets in B.

Computing Topos

to install in openSUSE:

in YaST install:

on command line:

git clone
cd bewl
sbt console

metadata block
see also:

Catsters youtube videos -

Adjunctions from Morphisms


These lectures are about physics using topos theory. It does not even get to topos until 5. parts 1-4 contains lots of other defintions.

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

flag flag flag flag flag flag The Princeton Companion to Mathematics - This is a big book that attempts to give a wide overview of the whole of mathematics, inevitably there are many things missing, but it gives a good insight into the history, concepts, branches, theorems and wider perspective of mathematics. It is well written and, if you are interested in maths, this is the type of book where you can open a page at random and find something interesting to read. To some extent it can be used as a reference book, although it doesn't have tables of formula for trig functions and so on, but where it is most useful is when you want to read about various topics to find out which topics are interesting and relevant to you.


Terminology and Notation

Specific to this page here:


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.