module Topoi.Base where
open _=>_
Grothendieck topoi🔗
Topoi are an abstraction introduced by Alexander Grothendieck in the 1960s as a generalisation of topological spaces, suitable for his work in algebraic geometry. Later (in the work of William Lawvere, and even later Myles Tierney), topoi found a new life as “categories with a nice internal logic”, which mirrors that of the category Perhaps surprisingly, every Grothendieck topos is also a topos in their logical conception (called elementary); Since elementary topoi are very hard to come by predicatively, we formalise a particular incarnation of Grothendieck’s notion here.
Grothendieck described his topoi by first defining a notion of site, which generalises the (poset of) open subsets of a topological space, and then describing what “sheaves on a site” should be, the corresponding generalisation of sheaves on a space. Instead of directly defining the notion of site, we will leave it implicitly, and define a topos as follows:
A topos is a full subcategory of a presheaf category (the category is part of the definition) such that the inclusion functor admits a left adjoint, and this left adjoint preserves finite limits. We summarise this situation in the diagram below, where “lex” (standing for “left exact”) is old-timey speak for “finite limit preserving”.
In type theory, we must take care about the specific universes in which everything lives. Now, much of Grothendieck topos theory generalises to arbitrary “base” topoi, via the use of bounded geometric morphisms, but the “main” definition talks about In particular, every universe generates a theory of the categories of sheaves on sites.
Fix a universe level and consider the category A topos might be a large category (i.e. it might have a space of objects with but it is essentially locally small, since it admits a fully-faithful functor into which have homs at level Hence, even if we allowed the category to have at a level we would have no more information there than fits in
For this reason, a topos only has two levels: The level of its objects, and the level of the category of Sets relative to which is a topos.
record Topos {o} κ (𝓣 : Precategory o κ) : Type (lsuc (o ⊔ κ)) where
field
: Precategory κ κ
site
: Functor 𝓣 (PSh κ site)
ι : is-fully-faithful ι
has-ff
: Functor (PSh κ site) 𝓣
L : is-lex L
L-lex
: L ⊣ ι
L⊣ι
module ι = Functor ι
module L = Functor L
module L⊣ι = _⊣_ L⊣ι
As generalised spaces🔗
I’ll echo here the standard definition of topological space, but due to personal failings I can’t motivate it. A topological space consists of a set of points and a topology a subset of its powerset which is closed under arbitrary unions and finite intersections.
Let’s reword that using category-theoretic language: Recall that the powerset of is the poset It is — being a functor category into a complete and cocomplete (thin) category — also complete and cocomplete, so all joins and finite meets (unions and intersections) exist; Furthermore, the distributive law
holds for any subset and family of subsets A lattice satisfying these properties (finite meets, arbitrary joins, the distributive law) is called a frame. A map of frames is defined to be a map of their underlying sets preserving finite meets and arbitrary joins — by abstract nonsense, this is the same as a function which preserves finite meets and has a right adjoint 1.
We can prove that a topology on is the same thing as a subframe of its powerset — a collection of subsets of closed under finite meets and arbitrary joins.
Now, the notion of “topos” as a generalisation of that of “topological space” is essentially self-evident: A topos is a sub-topos of a presheaf category We have essentially categorified “subframe” into “subtopos”, and into Note that, while this seems circular (“a topos is a sub-topos of…”), the notion of subtopos — or rather, of geometric embedding — makes no mention of actual topoi, and makes sense for any pair of categories.
As categories of spaces🔗
Another perspective on topoi is that they are categories of spaces, rather than spaces themselves. We start by looking at presheaf topoi, The coyoneda lemma tells us that every presheaf is a colimit of representables, which can be restated in less abstract terms by saying that presheaves are instructions for gluing together objects of The objects of are then interpreted as “primitive shapes”, and the maps in are interpreted as “maps to glue against”.
Let’s make this more concrete by considering an example: Take the category with two points — let’s call them and — and two arrows A presheaf on this category is given by a set a set and two functions We call the vertex set, and the edge set. Indeed, a presheaf on this category is a directed multigraph, and maps between presheaves preserve adjacency.
Our statement about “gluing primitive shapes” now becomes the rather pedestrian statement “graphs are made up of vertices and edges”. For instance, the graph can be considered as a disjoint union of two edges, which is then glued together in a way such that the target of the first is the source of the second. The maps exhibit the two ways that a vertex can be considered “part of” an edge.
As “logically nice” categories🔗
The definition of topos implies that any topos enjoys many of the same categorical properties of the category (see below). Topoi are complete and cocomplete, cartesian closed (even locally so) — colimits are stable under pullback, coproducts are disjoint, and equivalence relations are effective.
These properties, but especially local cartesian closure, imply that the internal logic of a topos is an incredibly nice form of type theory. Dependent sums and products exist, there is an object of natural numbers, the poset of subobjects of any object is a complete lattice (even a Heyting algebra), including existential and universal quantification. Effectivity of congruences means that two points in a quotient are identified if, and only if, they are related by the congruence.
In fact, this is essentially the definition of a topos. The actual definition, as a lex reflective subcategory of a presheaf category, essentially ensures that the category inherits the nice logical properties of (through the presheaf category, which is also very nice logically).
As was implicitly mentioned above, for a topos we call the category the site of definition. Objects in are called sheaves, and the functor is called sheafification. Maps between topoi are called geometric morphisms, and will be defined below. We denote the 2-category of topoi, geometric morphisms and natural transformations by following Johnstone. When is regarded as a topos unto itself, rather than an indirection in the definition of a sheaf topos, we call it the topos of .
Examples🔗
The “trivial” example of topoi is the category
which is equivalently the category
of presheaves on the terminal category. This is, in fact, the
terminal object in the 2-category
of topoi (morphisms are described below), so we denote it by
𝟙
.
: ∀ {κ} → Topos κ (Sets κ)
𝟙 {κ} = sets where
𝟙 open Topos
open Functor
open _⊣_
open is-lex
The inclusion functor is given by the “constant presheaf” functor, which sends each set to the constant functor with value
: Functor (Sets κ) (PSh κ (Lift-cat κ κ ⊤Cat))
incl .F₀ x .F₀ _ = x
incl .F₀ x .F₁ _ f = f
incl .F₀ x .F-id = refl
incl .F₀ x .F-∘ f g = refl
incl
.F₁ f = NT (λ _ → f) (λ _ _ _ → refl)
incl
.F-id = trivial!
incl .F-∘ f g = trivial!
incl
: Topos κ (Sets κ)
sets .site = Lift-cat κ κ ⊤Cat
sets
.ι = incl sets
This functor is fully faithful since a natural transformation between presheaves on the point is entirely determined by its component at.. well, the point. Hence, the map exhibits an inverse to the inclusion functor’s action on morphisms, which is sufficient (and necessary) to conclude fully-faithfulness.
.has-ff {x} {y} = is-iso→is-equiv isic where
sets open is-iso
: is-iso (incl .F₁ {x} {y})
isic .inv nt = nt .η _
isic .rinv nt = trivial!
isic .linv f = refl isic
The “sheafification” left adjoint is given by evaluating a presheaf at its sole section and similarly by evaluating a natural transformation at its one component
.L .F₀ F = F · _
sets .L .F₁ nt = nt · _
sets .L .F-id = refl
sets .L .F-∘ f g = refl sets
These functors actually define an adjoint equivalence of categories, is continuous and, in particular, lex. Rather than appealing to that theorem, though, we define the preservation of finite limits directly for efficiency concerns.
.L-lex .pres-⊤ {T} psh-terminal set = contr (cent .η _) uniq where
sets = incl .F₀ set
func = psh-terminal func .centre
cent : ∀ f → cent .η _ ≡ f
uniq = psh-terminal func .paths f' ηₚ _ where
uniq f : _ => _
f' .η _ = f
f' .is-natural _ _ _ = funext λ x → happly (sym (T .F-id)) _
f'
.L-lex .pres-pullback {P} {X} {Y} {Z} pb = pb' where
sets open is-pullback
: is-pullback (Sets κ) _ _ _ _
pb' .square = pb .square ηₚ _
pb' .universal {P'} {p₁' = p₁'} {p₂' = p₂'} p =
pb' .universal {P' = incl · P'}
pb {p₁' = NT (λ _ → p₁') (λ _ _ _ → funext λ _ → sym (X .F-id · _))}
{p₂' = NT (λ _ → p₂') (λ _ _ _ → funext λ _ → sym (Y .F-id · _))}
(Nat-pathp _ _ (λ x → p)) · lift tt
.p₁∘universal = pb .p₁∘universal ηₚ _
pb' .p₂∘universal = pb .p₂∘universal ηₚ _
pb' .unique {P'} {lim' = lim'} p1 p2 =
pb' .unique {lim' = l'} (Nat-pathp _ _ λ _ → p1) (Nat-pathp _ _ λ _ → p2) ηₚ _
pb where
: incl .F₀ P' => P
l' .η _ = lim'
l' .is-natural x y f i o = P .F-id (~ i) (lim' o) l'
Similarly, we can construct the adjunction unit and counit by looking at components and constructing identity natural transformations.
.L⊣ι .unit .η _ .η _ f = f
sets .L⊣ι .unit .η F .is-natural _ _ _ = F .F-id
sets .L⊣ι .unit .is-natural _ _ _ = trivial!
sets
.L⊣ι .counit .η _ x = x
sets .L⊣ι .counit .is-natural _ _ _ = refl
sets
.L⊣ι .zig = refl
sets .L⊣ι .zag = trivial! sets
More canonical examples are given by any presheaf category, where both the inclusion and sheafification functors are the identity. Examples of presheaf topoi are abundant in abstract homotopy theory (the categories of cubical and simplicial sets) — which also play an important role in modelling homotopy type theory; Another example of a presheaf topos is the category of quivers (directed multigraphs).
: ∀ {κ} (C : Precategory κ κ) → Topos κ (PSh κ C)
Presheaf {κ} C = psh where
Presheaf open Functor
open Topos
: Topos _ _
psh .site = C
psh .ι = Id
psh .has-ff = id-equiv
psh .L = Id
psh .L-lex .is-lex.pres-⊤ c = c
psh .L-lex .is-lex.pres-pullback pb = pb
psh .L⊣ι = adj where
psh open _⊣_
: Id ⊣ Id
adj .unit = NT (λ _ → idnt) λ x y f → trivial!
adj .counit = NT (λ _ → idnt) λ x y f → trivial!
adj .zig = trivial!
adj .zag = trivial! adj
Properties of topoi🔗
The defining property of a topos is that it admits a geometric embedding into a presheaf category, meaning the adjunction is very special indeed: Since the right adjoint is fully faithful, the adjunction is monadic, meaning that it exhibits as the category of algebras for a (lex, idempotent) monad: the “sheafification monad”. This gives us completeness in for “free” (really, it’s because presheaf categories are complete, and those are complete because is.)
module _ {o κ} {𝓣 : Precategory o κ} (T : Topos κ 𝓣) where
open Topos T
: Monad-on _
Sheafify = Adjunction→Monad L⊣ι
Sheafify
: is-monadic L⊣ι
Sheafify-monadic = is-reflective→is-monadic L⊣ι has-ff
Sheafify-monadic
: is-complete κ κ 𝓣
Topos-is-complete = equivalence→complete
Topos-is-complete (is-equivalence.inverse-equivalence Sheafify-monadic)
(Eilenberg-Moore-is-complete _
(Functor-cat-is-complete (Sets-is-complete {ι = κ} {κ} {κ})))
Furthermore, since preserves colimits (it is a left adjoint), then we can compute the colimit of some diagram as the colimit (in of — which exists because is cocomplete — then apply to get a colimiting cocone for But the counit of the adjunction is a natural isomorphism, so we have a colimiting cocone for
: is-cocomplete κ κ 𝓣
Topos-is-cocomplete =
Topos-is-cocomplete F
natural-iso→colimit(F∘-iso-id-l (is-reflective→counit-iso L⊣ι has-ff))
sheafifiedwhere
: Colimit (ι F∘ F)
psh-colim = Functor-cat-is-cocomplete (Sets-is-cocomplete {ι = κ} {κ} {κ}) _
psh-colim
: Colimit ((L F∘ ι) F∘ F)
sheafified = subst Colimit F∘-assoc $
sheafified left-adjoint-colimit L⊣ι psh-colim
Since the reflector is left exact, and thus in particular preserves finite products, a theorem of Johnstone (Elephant A4.3.1) implies the topos is an exponential ideal in If is a sheaf, and is any presheaf, then the internal hom is a sheaf: topoi are cartesian closed.