definition example theorem

A topos (plural toposes or topoi) is a Category that behaves like well enough to do logic inside it. 7 Sketches uses the Grothendieck (sheaf) definition: a topos is a category of sheaves on a site, e.g. on a Topological Space. The more general elementary topos of Lawvere–Tierney is a category that

  1. has all finite limits (a Terminal Object and pullbacks suffice),
  2. is cartesian closed, and
  3. has a Subobject Classifier .

Every Grothendieck topos is an elementary topos. Facts true in any topos (7 Sketches §7.2.1): has all (finite) limits and colimits, is cartesian closed, has epi-mono factorizations, and has a subobject classifier.

Sources: 7 Sketches §7.1–§7.2 (Set as an exemplar topos), §7.4 (Toposes), footnote 4 (elementary topos), footnotes 9–10, §7.6 ([MM92], [Joh02], [McL92]); DaoFP §11 (dependent types), §17 (presheaf categories); CTfS §5.2.1 (“database states on form a topos”), §4.2.4.5 (Lawvere’s categorical characterization of )

Examples

topossitetruth values
the one-point space (Example 7.48)
-, presheaves a small category with trivial coverssieves on
the arrow shape (Example 7.23)the graph , see Topos of Graphs
a Topological Space open subsets of
the Interval Domainopen sets of time intervals

Why care

  • Each topos has an internal language — a higher-order logic with whose semantics (Kripke–Joyal) is given by the Subobject Classifier, the Heyting Algebra of predicates, and Quantification. “Any object understands itself — its parts and the logic of how they fit together — by asking questions of the oracle .”
  • Truth values in a sheaf topos are open sets: a proposition is “true on ”, not merely true or false. This lets one define graphs, groups or spaces that change through time (Topos of Behavior Types) and prove safety properties in a temporal logic.
  • For databases (CTfS §5.2.1): the instances on any schema form a topos, “which means that just about every consideration we made for sets holds for instances on any schema” — elements become representables, subsets become sub-instances classified by , and so on (Category of Sets has CTfS’s dictionary). Lawvere showed that itself is “merely a category with certain properties” (the elementary theory of the category of sets, ETCS; CTfS §4.2.4.5).
  • Toposes were invented by Grothendieck’s school ([AGV71]) for the Weil conjectures; Lawvere and Tierney recognized their logical content.

Docs: C-set morphisms · ACSets API · Graphs

using Catlab
# Catlab's C-sets (ACSets) form presheaf toposes: finite limits, colimits,
# a Heyting algebra of subobjects, and a subobject classifier are all available.
G = path_graph(Graph, 3)
Ω, _ = subobject_classifier(Graph)       # the graph Ω_Grph: 2 vertices, 5 edges
nparts(Ω, :V), nparts(Ω, :E)            # (2, 5)
A = Subobject(G, V=[1, 2], E=[1])
B = Subobject(G, V=[2, 3], E=[2])
A ∧ B, A ∨ B, implies(A, B), ¬A          # Heyting operations on Sub(G)
import Mathlib
open CategoryTheory
-- Mathlib has the ingredients of an elementary topos (no single `Topos` class yet):
#check @CategoryTheory.HasSubobjectClassifier   -- subobject classifier
#check @CategoryTheory.MonoidalClosed           -- exponentials (with cartesian monoidal structure)
#check @CategoryTheory.Limits.HasFiniteLimits
-- and Grothendieck toposes as sheaf categories:
#check @CategoryTheory.Sheaf                -- Sheaf J A for a Grothendieck topology J
#check @TopCat.Sheaf                        -- sheaves on a topological space
-- Hask is not a topos, but Set-like reasoning shows up as: Bool is the subobject
-- classifier of finite types, and predicates are characteristic functions.
type Predicate a = a -> Bool
subobject :: [a] -> Predicate a -> [a]       -- {Y | p}
subobject ys p = filter p ys