module Topoi.Base where
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 site : Precategory Îș Îș Îč : Functor đŁ (PSh Îș site) has-ff : is-fully-faithful Îč L : Functor (PSh Îș site) đŁ L-lex : is-lex L 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
incl : 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! sets : Topos Îș (Sets Îș) sets .site = Lift-cat Îș Îș â€Cat sets .Îč = incl
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.
sets .has-ff {x} {y} = is-isoâis-equiv isic where open is-iso isic : is-iso (incl .Fâ {x} {y}) isic .inv nt = nt .η _ isic .rinv nt = trivial! isic .linv f = refl
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
sets .L .Fâ F = F # _ sets .L .Fâ nt = nt # _ sets .L .F-id = refl sets .L .F-â f g = refl
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.
sets .L-lex .pres-†{T} psh-terminal set = contr (cent .η _) uniq where func = incl .Fâ set cent = psh-terminal func .centre uniq : â f â cent .η _ ⥠f uniq f = psh-terminal func .paths f' ηâ _ where f' : _ => _ f' .η _ = f f' .is-natural _ _ _ = funext λ x â happly (sym (T .F-id)) _ sets .L-lex .pres-pullback {P} {X} {Y} {Z} pb = pb' where open is-pullback pb' : is-pullback (Sets Îș) _ _ _ _ pb' .square = pb .square ηâ _ pb' .universal {P'} {pâ' = pâ'} {pâ' = pâ'} p = pb .universal {P' = incl # P'} {pâ' = NT (λ _ â pâ') (λ _ _ _ â funext λ _ â sym (X .F-id # _))} {pâ' = NT (λ _ â pâ') (λ _ _ _ â funext λ _ â sym (Y .F-id # _))} (Nat-pathp _ _ (λ x â p)) # lift tt pb' .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) ηâ _ where l' : incl .Fâ P' => P l' .η _ = lim' l' .is-natural x y f i o = P .F-id (~ i) (lim' o)
Similarly, we can construct the adjunction unit and counit by looking at components and constructing identity natural transformations.
sets .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!
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).
Presheaf : â {Îș} (C : Precategory Îș Îș) â Topos Îș (PSh Îș C) Presheaf {Îș} C = psh where open Functor open Topos psh : 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 open _âŁ_ adj : Id ⣠Id adj .unit = NT (λ _ â idnt) λ x y f â trivial! adj .counit = NT (λ _ â idnt) λ x y f â trivial! adj .zig = trivial! adj .zag = trivial!
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 Sheafify : Monad (PSh Îș site) Sheafify = AdjunctionâMonad LâŁÎč Sheafify-monadic : is-monadic LâŁÎč Sheafify-monadic = is-reflectiveâis-monadic LâŁÎč has-ff Topos-is-complete : is-complete Îș Îș đŁ Topos-is-complete = equivalenceâ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
Topos-is-cocomplete : is-cocomplete Îș Îș đŁ Topos-is-cocomplete F = natural-isoâcolimit (Fâ-iso-id-l (is-reflectiveâcounit-iso LâŁÎč has-ff)) sheafified where psh-colim : Colimit (Îč Fâ F) psh-colim = Functor-cat-is-cocomplete (Sets-is-cocomplete {Îč = Îș} {Îș} {Îș}) _ sheafified : Colimit ((L Fâ Îč) Fâ F) sheafified = subst Colimit Fâ-assoc $ 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.
Since topoi are defined as embedding faithfully into a category of presheaves, it follows that they have a small generating set, in the same sense that representables generate presheaves: In fact, the generating set of a Grothendieck topos is exactly the set of representables of its site!
Elaborating, letting be a topos, two maps are equal if and only if they are equal under i.e. as maps of presheaves. But it follows from the coyoneda lemma that maps of presheaves are equal if and only if they are equal on all representables. Consequently, two maps in a are equal if and only if they agree on all generalised elements with domain the sheafification of a representable:
module _ {o â} {C : Precategory o â} (ct : Topos â C) where private module C = Cat.Reasoning C module ct = Topos ct module Site = Cat.Reasoning (ct.site) module PSh = Cat.Reasoning (PSh â ct.site) module Îč = Functor (ct.Îč) module L = Functor (ct.L) open _âŁ_ (ct.LâŁÎč) open Functor open _=>_
Representables-generate : â {X Y} {f g : C.Hom X Y} â ( â {A} (h : C.Hom (L.â (ăâ ct.site A)) X) â f C.â h ⥠g C.â h ) â f ⥠g Representables-generate {f = f} {g} sep = ffâfaithful {F = ct.Îč} ct.has-ff $ Representables-generate-presheaf ct.site λ h â Îč.â f PSh.â h âĄâš mangle â©âĄ Îč.â â f C.â counit.Δ _ C.â L.â h â PSh.â unit.η _ âĄâš ap! (sep _) â©âĄ Îč.â (g C.â counit.Δ _ C.â L.â h) PSh.â unit.η _ âĄËâš mangle â©âĄË Îč.â g PSh.â h â
where mangle : â {X Y} {f : C.Hom X Y} {Z} {h : PSh.Hom Z _} â Îč.â f PSh.â h ⥠Îč.â (f C.â counit.Δ _ C.â L.â h) PSh.â unit.η _ mangle {f = f} {h = h} = Îč.â f PSh.â h âĄâš PSh.insertl zag â©âĄ Îč.â (counit.Δ _) PSh.â â unit.η _ PSh.â Îč.â f PSh.â h â âĄâš ap! (PSh.extendl (unit.is-natural _ _ _)) â©âĄ Îč.â (counit.Δ _) PSh.â Îč.â (L.â (Îč.â f)) PSh.â â unit.η _ PSh.â h â âĄâš ap! (unit.is-natural _ _ _) â©âĄ Îč.â (counit.Δ _) PSh.â â Îč.â (L.â (Îč.â f)) PSh.â Îč.â (L.â h) PSh.â unit.η _ â âĄâš ap! (PSh.pulll (sym (Îč.F-â _ _))) â©âĄ Îč.â (counit.Δ _) PSh.â Îč.â (L.â (Îč.â f) C.â L.â h) PSh.â unit.η _ âĄâš PSh.pulll (sym (Îč.F-â _ _)) â©âĄ Îč.â â counit.Δ _ C.â L.â (Îč.â f) C.â L.â h â PSh.â unit.η _ âĄâš ap! (C.extendl (counit.is-natural _ _ _)) â©âĄ Îč.â (f C.â counit.Δ _ C.â L.â h) PSh.â unit.η _ â
Finally, the property of âbeing a toposâ is invariant under slicing. More specifically, since a given topos can be presented by different sites, a presentation can be sliced under an object to present as a sheaf topos, with site of definition This follows from a wealth of pre-existing theorems:
- A pair of adjoint functors can be sliced under an object giving an adjunction Slicing a functor preserves full-faithfulness and left exactness, hence slicing a geometric embedding gives a geometric embedding.
- The category is equivalent to the category hence âbeing a presheaf topos is stable under slicingâ. Furthermore, this equivalence is part of an ambidextrous adjunction, hence both functors preserve limits.
- Dependent sum along an isomorphism is an equivalence of categories; But since a topos is presented by a reflective subcategory inclusion, the counit is an isomorphism.
module _ {o â} {C : Precategory o â} (T : Topos â C) (X : â C â) where private module C = Cat.Reasoning C module Co = Cat.Reasoning (Slice C X) module T = Topos T open Topos open Functor
We build the geometric embedding presenting as a topos by composing the adjunctions and â where is the equivalence The right adjoint is fully faithful because it composes two fully faithful functors (a slice of and an equivalence), the left adjoint preserves finite limits because it is a composite of two equivalences (hence two right adjoints) and a lex functor.
Slice-topos : Topos â (Slice C X) Slice-topos .site = â« T.site (T.Îč.Fâ X) Slice-topos .Îč = sliceâtotal Fâ Sliced (T.Îč) X Slice-topos .has-ff = â-is-equiv (Sliced-ff {F = T.Îč} (T.has-ff)) sliceâtotal-is-ff Slice-topos .L = (ÎŁf (T .LâŁÎč.counit.Δ _) Fâ Sliced (T.L) (T.Îč.Fâ X)) Fâ totalâslice Slice-topos .L-lex = Fâ-is-lex (Fâ-is-lex (right-adjointâlex (is-equivalence.Fâ»ÂčâŁF (ÎŁ-iso-equiv (C.isoâinvertible (is-reflectiveâcounit-is-iso T.LâŁÎč T.has-ff))))) (Sliced-lex T.L-lex)) (right-adjointâlex (sliceâtotal-is-equiv .is-equivalence.FâŁFâ»Âč)) Slice-topos .LâŁÎč = LFâŁGR (is-equivalence.Fâ»ÂčâŁF sliceâtotal-is-equiv) (Sliced-adjoints T.LâŁÎč)
Geometric morphismsđ
The definition of a topos as a generalisation of topological space leads us to look for a categorification of âcontinuous mapâ to functors between topoi. In the same way that a continuous function may be seen as a homomorphism of frames with defining feature the preservation of finite meets and arbitrary joins, we shall define a geometric morphism to be a functor which is left exact and admits a right adjoint.
Why the right adjoint? Well, right adjoints preserve limits, but by duality, left adjoints preserve colimits. This embodies the âarbitrary joinsâ part of a map of frames, whereas the âfinite meetsâ come from left exactness.
private variable o â o' â' Îș Îș' Îș'' s s' : Level E F G : Precategory o â lvl : â {o â o' â'} â Precategory o â â Precategory o' â' â Level lvl {o} {â} {o'} {â'} _ _ = o â â â â' â o'
record Geom[_,_] (E : Precategory o â) (F : Precategory o' â') : Type (lvl E F) where no-eta-equality field Inv[_] : Functor F E Dir[_] : Functor E F Inv-lex : is-lex Inv[_] InvâŁDir : Inv[_] ⣠Dir[_] open Geom[_,_] public
Computation establishes that the identity functor is left exact, and self adjoint, so it is in particular both the direct and inverse image parts of a geometric morphism
Idg : Geom[ E , E ] Idg {E = E} = record { Inv[_] = Id ; Dir[_] = Id ; Inv-lex = lex ; InvâŁDir = adj }
where module E = Cat.Reasoning E lex : is-lex Id lex .is-lex.pres-†f = f lex .is-lex.pres-pullback p = p adj : Id ⣠Id adj ._âŁ_.unit .η _ = E.id adj ._âŁ_.unit .is-natural x y f = sym E.id-comm adj ._âŁ_.counit .η _ = E.id adj ._âŁ_.counit .is-natural x y f = sym E.id-comm adj ._âŁ_.zig = E.idl _ adj ._âŁ_.zag = E.idl _
Since adjunctions compose, geometric morphisms do, too. Observe that the composite of inverse images and the composite of direct images go in different directions! Fortunately, this matches the convention for composing adjunctions, where the functors âswap sidesâ:
_Gâ_ : Geom[ F , G ] â Geom[ E , F ] â Geom[ E , G ] f Gâ g = mk where module f = Geom[_,_] f module g = Geom[_,_] g open is-lex mk : Geom[ _ , _ ] Inv[ mk ] = Inv[ g ] Fâ Inv[ f ] Dir[ mk ] = Dir[ f ] Fâ Dir[ g ] mk .InvâŁDir = LFâŁGR f.InvâŁDir g.InvâŁDir
The composition of two left-exact functors is again left-exact, so thereâs no impediment to composition there, either.
mk .Inv-lex .pres-†term ob = g.Inv-lex .pres-†(f.Inv-lex .pres-†term) _ mk .Inv-lex .pres-pullback pb = g.Inv-lex .pres-pullback (f.Inv-lex .pres-pullback pb)
An important class of geometric morphism is the geometric
embedding, which weâve already met as the very definition of
Topos
. These are the
geometric morphisms with fully faithful direct image. These are
again closed under composition, so if we want to exhibit that a
certain category
is a topos, it suffices to give a geometric embedding
where
is some topos which is convenient for this application.
record Geom[_âȘ_] (E : Precategory o â) (F : Precategory o' â') : Type (lvl E F) where field morphism : Geom[ E , F ] has-ff : is-fully-faithful Dir[ morphism ] Geometric-embeddings-compose : Geom[ F âȘ G ] â Geom[ E âȘ F ] â Geom[ E âȘ G ] Geometric-embeddings-compose f g = record { morphism = f .morphism Gâ g .morphism ; has-ff = â-is-equiv (g .has-ff) (f .has-ff) } where open Geom[_âȘ_] Toposâgeometric-embedding : (T : Topos Îș E) â Geom[ E âȘ PSh Îș (T .Topos.site) ] Toposâgeometric-embedding T = emb where emb : Geom[ _ âȘ _ ] Inv[ emb .Geom[_âȘ_].morphism ] = T .Topos.L Dir[ emb .Geom[_âȘ_].morphism ] = T .Topos.Îč emb .Geom[_âȘ_].morphism .Inv-lex = T .Topos.L-lex emb .Geom[_âȘ_].morphism .InvâŁDir = T .Topos.LâŁÎč emb .Geom[_âȘ_].has-ff = T .Topos.has-ff
By the adjoint functor theorem, any map between posets which preserves arbitrary joins has a right adjoint; Conversely, every map which has a right adjoint preserves arbitrary joins.â©ïž