What is special about sets?
Almost all of mathematics can be carried out inside the category of sets and functions. Which features of does it actually use? Three stand out:
- we can form finite limits — products, solution sets of equations, inverse images;
- we can form function sets , and functions of two variables correspond to functions into function sets;
- subsets are the same as predicates: a subset is the same thing as its characteristic function .
Around 1969–70, F. William Lawvere and Myles Tierney took these three features as axioms for a category. The result, an elementary topos, turned out to describe a remarkable range of "universes of sets": sheaves on a topological space, sets equipped with a group action, sets that vary along stages of knowledge, a universe in which every function is computable. Mathematics can be done inside each of them — but in most of them the logic is intuitionistic: a statement can be "true on part of the space", and the law of excluded middle need not hold.
About a decade earlier Alexander Grothendieck had reached the same objects from algebraic geometry, as the right notion of "generalised space" for cohomology. Topos theory is where these two lines meet. This lesson builds on categorical logic (cartesian closed categories, Heyting algebras), limits and the Yoneda lemma.
Truth values that are not just true or false
Take a very small space, the Sierpiński space whose open sets are . A sheaf on amounts to a set of global sections, a set of sections over the open point, and a restriction map . (The empty open set contributes a single section, and no cover of omits itself, so there is no gluing condition.)
So consider a set ("sections over the whole space"), a set ("sections over the open point") and a map , together with a sub-collection: subsets and with . For a global section , how true is ""? There are three possibilities:
- : true everywhere;
- but : true on the open point only;
- : true nowhere.
The truth value of "" is the open set on which it holds: , or . In — sheaves on a one-point space — only "everywhere" and "nowhere" are possible, and we get the familiar two truth values.
Topos theory takes this seriously: an object of truth values, whose "elements" may be partial truths, and a logic computed from it.
Analogy, not a formal construction
Lawvere's slogan is that the objects of a topos are variable sets — sets varying over the points of a space, over stages of time or knowledge, or under the action of a group. The slogan is a guide to intuition, not a definition: the definition below mentions only objects, arrows and universal properties.
Definitions
Throughout, is a category with finite limits; denotes a terminal object.
Definition— subobject
A subobject of is an isomorphism class of monomorphisms , where when for an isomorphism . Subobjects of form a poset , ordered by factorisation. Pulling back along gives a monotone map .
Definition— subobject classifier
A subobject classifier is an object with an arrow such that for every monomorphism there is a unique arrow for which the square below is a pullback. Equivalently, , naturally in : the functor is representable, represented by .
Definition— elementary topos
An elementary topos is a category that
- has all finite limits,
- is cartesian closed: every functor has a right adjoint , so naturally, and
- has a subobject classifier .
Combining (2) and (3) gives power objects with ; a classical theorem says that "finite limits + power objects" is an equivalent definition. Finite colimits are not assumed: Robert Paré (1974) proved that they follow, because the functor is monadic.
Definition— Boolean topos
A topos is Boolean if every subobject has a complement: some with and in . Equivalently, is an isomorphism, where classifies .
Definition— presheaf; sieve
For a small category , a presheaf is a functor ; for we write , ("restriction along "). A sieve on is a set of arrows with codomain that is closed under precomposition: implies . For , the pullback of is the sieve on . The maximal sieve consists of all arrows into .
Definition— Grothendieck topology; Grothendieck topos
A Grothendieck topology on assigns to each object a set of "covering" sieves such that the maximal sieve covers, covers are stable under pullback (), and covering is local (if and is a sieve on with for all in , then ). A presheaf is a sheaf if, for every covering sieve on , every compatible family — one with — is for exactly one . A Grothendieck topos is a category equivalent to the category of sheaves on a small site.
Definition— natural numbers object
A natural numbers object is a diagram such that for every there is a unique with and — definition by recursion, as an axiom.
Examples and non-examples
Example— Sets
is a topos with and (proved below). It is Boolean and has a natural numbers object . The category of finite sets is also a topos — same , finite function sets — but has no natural numbers object.
Example— Sets with a group action
For a group , the category of left -sets is the presheaf category on the one-object category with arrows the elements of (with composition reversed). A sieve on the unique object is a set of arrows closed under precomposition; since every arrow is invertible, a non-empty sieve contains everything. So with the trivial action, and is Boolean. Yet for it is not equivalent to : the epimorphism ( acting on itself) has no section, because a section would pick a point of fixed by every group element. Boolean does not imply "every epimorphism splits"; by Diaconescu's theorem (1975) the converse implication does hold in every topos.
Example— The Sierpiński topos
Presheaves on the poset (viewed as a category with one arrow ) are exactly the triples of the intuition section, and this category is equivalent to sheaves on the Sierpiński space. By the theorem below its subobject classifier is the presheaf of sieves:
- sieves on : and , so has 2 elements;
- sieves on : , and , so has 3 elements;
- restriction pulls back along : , while both non-empty sieves go to .
The three elements of are exactly the three truth values "true", "true only after restriction" and "false" of the intuition section.
Example— Sheaves on a space
For a topological space , — sheaves on the site of open sets, covered by open covers — is a Grothendieck topos. Its subobject classifier is with restriction . For a subsheaf and , is the largest open subset of on which belongs to (the union of all such opens; the restrictions of glue inside because is a sheaf). The global truth values form the frame of open sets, whose Heyting negation is . So for and we get : excluded middle fails on the open set of truth values.
Example— Non-examples
- : the trivial group is both initial and terminal. In any topos the initial object is strict (every arrow into is an isomorphism), so would make every arrow an isomorphism and every object initial. Hence a topos with is trivial, and is not a topos.
- (posets and monotone maps) is cartesian closed but not a topos: the identity function from the two-element discrete poset to the chain is monic and epic but not an isomorphism, whereas every topos is balanced (monic + epic implies iso, since every mono is the equaliser of and ).
- is not even cartesian closed: does not preserve all quotients, so it cannot be a left adjoint.
Set and presheaf categories are toposes
Theorem— Theorem 1 (Set is a topos)
is an elementary topos, with subobject classifier .
Proof
Finite limits: the one-point set is terminal, is a product, and is a pullback of . Exponentials: let be the set of all functions ; a function corresponds to , and this is a bijection natural in (currying). Classifier: monomorphisms in are injections, and is isomorphic to the inclusion of its image . Define if and otherwise. The pullback of along is , so the square is a pullback. If also has pullback , then , so , since has only two elements.
∎
Now fix a small category and write and for the Yoneda embedding, .
Theorem— Lemma 2 (subobjects of presheaves)
A natural transformation in is a monomorphism if and only if every component is injective. Hence is isomorphic to the poset of subpresheaves of : families closed under restriction.
Proof
If every is injective, is clearly monic. Conversely let be monic and with . By Yoneda, and correspond to natural transformations , and , correspond to , so . Since is monic, , i.e. . Finally, a pointwise injective is isomorphic to the inclusion of its image, which is a subpresheaf by naturality.
∎
Theorem— Theorem 3 (presheaf categories are toposes)
is an elementary topos. Its subobject classifier is the presheaf of sieves: is the set of sieves on , , and is the maximal sieve. The characteristic map of a subpresheaf is
Proof
Finite limits are computed objectwise: , with the evident restriction maps, has the universal property because a cone in is a cone at every object, naturally.
Exponentials. If exists, Yoneda forces . Defining , with restriction by precomposition with , one checks that corresponds naturally to ; we omit this routine verification (Mac Lane and Moerdijk 1992, Chapter I).
The classifier. First, is a presheaf: is a sieve, and . Note the key fact
since contains iff , and a sieve containing an identity is maximal.
Let be a subpresheaf and define as in the statement.
- is a sieve: if and , then , because is closed under restriction.
- is natural: for , .
- Pullback: pullbacks are computed objectwise, and by with , . So the pullback of along is .
- Uniqueness: let be natural with pullback of equal to . For and , using naturality of in the second step and the pullback property in the third. So .
By Lemma 2 every subobject is represented by a subpresheaf, so is a subobject classifier.
∎
Note
Yoneda also predicts : if a classifier exists, , and a subpresheaf of is precisely a sieve on . For sheaves on a site the classifier is the sheaf of closed sieves (Mac Lane and Moerdijk 1992, Chapter III).
The internal logic is intuitionistic
Theorem— Theorem 4 (subobjects form a Heyting algebra)
For a presheaf on , the subpresheaves of form a Heyting algebra, with and computed objectwise, , and
Proof
Objectwise intersections and unions of subpresheaves are subpresheaves, and the distributive lattice laws hold objectwise. is closed under restriction: if and , then for we have , so the condition for at is the condition for at . Residuation, :
- () if , apply the defining condition with to get ;
- () if and , then because is a subpresheaf, so .
∎
The quantifier "for all " — at every stage reachable from — is what separates from the Boolean . In particular negation is : " is never in , at any stage reachable by restriction".
More generally, in every elementary topos each is a Heyting algebra, the maps are Heyting algebra maps with adjoints , and is an internal Heyting algebra. This is what it means to say that the internal logic of a topos is intuitionistic: higher-order intuitionistic logic is sound for interpretation in any topos, and complete with respect to all toposes (Lambek and Scott 1986). For proofs see Mac Lane and Moerdijk (1992), Chapters IV and VI.
Theorem— Proposition 5 (truth values of a presheaf topos on a poset)
Let be a poset, viewed as a category. Then in is the Heyting algebra of down-sets of , with . In particular, for there are exactly three truth values (the down-sets ), and the topos is not Boolean: , so , although .
Proof
, so a subpresheaf of is a set of objects with , : a down-set. The formula for is Theorem 4. For : , since for both . Hence , and . If had a complement , disjointness would force , hence (a down-set), and then .
∎
Since every finite distributive lattice is the lattice of down-sets of its poset of join-irreducible elements (Birkhoff's representation theorem), and a finite distributive lattice is automatically a Heyting algebra, every finite Heyting algebra occurs as of a presheaf topos on a finite poset. Combined with the finite model property of intuitionistic propositional logic, a propositional formula holds for all truth values of all such toposes exactly when it is intuitionistically provable. This is Kripke semantics in topos form: a Kripke frame corresponds to presheaves on .
ETCS: set theory in the language of arrows
Lawvere's Elementary Theory of the Category of Sets (1964) predates elementary toposes and axiomatises sets structurally: there is no global membership relation, only sets and functions. In the modern topos-theoretic packaging (following Lawvere, Tierney and others around 1970), ETCS says:
Definition— ETCS
A model of ETCS is a category such that
- is an elementary topos (finite limits, function sets, a subobject classifier);
- is well-pointed: , and arrows are determined by their effect on elements, where an element of is an arrow — if for all then ;
- has a natural numbers object;
- choice: every epimorphism has a section.
Leinster (2014) spells these out as ten informal axioms — associativity of composition, a set with exactly one element, functions determined by their effect on elements, and so on. Some consequences: a well-pointed topos is Boolean and two-valued, so ; and by Diaconescu's theorem the choice axiom alone already implies excluded middle.
Comparison with ZFC.
| ZFC | ETCS | |
|---|---|---|
| Primitive notions | sets and a global membership relation | sets (objects) and functions (arrows), with composition |
| Elements | sets are made of sets; "is ?" is meaningful | an element of is an arrow ; elements have no internal structure |
| Subsets | subsets via Separation | subobjects, classified by maps |
| Extensionality | two sets with the same members are equal | well-pointedness: two functions agreeing on elements are equal |
| Infinity | an inductive set | a natural numbers object |
| Replacement | an axiom scheme | not included |
Consistency strength. ETCS is equiconsistent with bounded Zermelo set theory with choice — Zermelo set theory with Separation restricted to formulas whose quantifiers are bounded, and without Replacement (Mitchell 1972, Cole 1973, Osius 1974). Since ZFC proves the consistency of bounded Zermelo set theory (for instance is a model), ZFC proves the consistency of ETCS; and ETCS cannot prove the consistency of ZFC unless ZFC is inconsistent (ZFC interprets ETCS, so this would contradict Gödel's second incompleteness theorem). So ETCS is strictly weaker than ZFC in consistency strength. Adding a suitable categorical axiom of replacement to ETCS yields a theory of the same strength as ZFC (McLarty 2004; see also Leinster 2014). Much of mathematics outside set theory itself uses neither Replacement nor global membership — a point stressed by Lawvere and by Mac Lane — which is why many working mathematicians find ETCS a faithful description of how sets are actually used; see ZFC for the other side.
The Sierpiński topos in Lean
We formalise the subobject classifier of the Sierpiński topos from scratch, and cite Mathlib for the general theorem about presheaf categories.
A presheaf on is a pair of types with a restriction map; subpresheaves are pairs of sets closed under restriction (Lemma 2 justifies using them as subobjects):
/-- A **presheaf on the poset `{0 < 1}`**: a type `A₁` of "sections at stage 1", a type `A₀` of
"sections at stage 0", and the restriction map `res : A₁ → A₀` along `0 ≤ 1`. (A functor
`{0 < 1}ᵒᵖ ⥤ Type` is exactly this data: the identities must go to identities, so only `res` is
free.) The category of these is the **Sierpiński topos**, also the arrow category of `Type`. -/
structure Psh where
/-- Sections at stage `1`. -/
A1 : Type
/-- Sections at stage `0`. -/
A0 : Type
/-- Restriction from stage `1` to stage `0`. -/
res : A1 → A0/-- A **subpresheaf** of `A`: a subset at each stage, closed under restriction. Subobjects of a
presheaf (monomorphisms into it, up to isomorphism) correspond exactly to subpresheaves, because
monomorphisms of presheaves are the pointwise injective natural transformations. -/
@[ext]
structure Sub (A : Psh) where
/-- The part at stage `1`. -/
S1 : Set A.A1
/-- The part at stage `0`. -/
S0 : Set A.A0
/-- Restricting a section in the subpresheaf stays in the subpresheaf. -/
closed : ∀ x, x ∈ S1 → A.res x ∈ S0A sieve on is encoded by two propositions — "contains " and "contains " — with the first implying the second. This is the sieve description of Theorem 3, and it is faithful even intuitionistically: we never decide whether a proposition is true.
/-- The **subobject classifier** `Ω`. Its stage-`0` sections are the sieves on `0`, i.e. truth
values `Prop`. A sieve on `1` is a downward-closed set of arrows into `1`; it is determined by two
propositions — "contains `id₁`" (true *now*) and "contains `0 ≤ 1`" (true *after restriction*) —
with the first implying the second. Restriction forgets the first. -/
def Omega : Psh where
A1 := {p : Prop × Prop // p.1 → p.2}
A0 := Prop
res p := p.1.2The characteristic map and the pullback of are defined exactly as in the proof of Theorem 3, and the two round trips are the existence and uniqueness halves of the classifier axiom:
/-- The **characteristic map** `χ_S : A ⟶ Ω` of a subpresheaf `S`. A section `x` at stage `1` is
sent to the sieve "`x ∈ S` now, and `res x ∈ S` after restriction"; a section at stage `0` to the
proposition `y ∈ S`. Naturality holds by definition. -/
def chi {A : Psh} (S : Sub A) : Hom A Omega where
f1 x := ⟨(x ∈ S.S1, A.res x ∈ S.S0), S.closed x⟩
f0 y := y ∈ S.S0
comm _ := rfl/-- The **pullback of `true` along `φ : A ⟶ Ω`**. Pullbacks of presheaves are computed stage by
stage, so this is the subpresheaf of sections that `φ` sends to `true` (the maximal sieve at stage
`1`, the proposition `True` at stage `0`). Closure under restriction comes from naturality of `φ`. -/
def pullbackTrue {A : Psh} (φ : Hom A Omega) : Sub A where
S1 := {x | φ.f1 x = top1}
S0 := {y | φ.f0 y}
closed x hx := by
have h1 : (φ.f1 x).1.1 := (eq_top1_iff _).1 hx
have h2 : Omega.res (φ.f1 x) := (φ.f1 x).2 h1
show φ.f0 (A.res x)
rw [← φ.comm x]
exact h2/-- Pulling `true` back along `χ_S` recovers `S`: the square
`S ↪ A`, `χ_S : A → Ω`, `true : 1 → Ω` is a pullback. -/
theorem pullbackTrue_chi {A : Psh} (S : Sub A) : pullbackTrue (chi S) = S := by
ext x
· show (chi S).f1 x = top1 ↔ x ∈ S.S1
rw [eq_top1_iff]
rfl
· rfl/-- Conversely, every natural map `φ : A ⟶ Ω` is the characteristic map of the subpresheaf it
classifies. At stage `1` the "now" component is recovered by `eq_top1_iff` and the "after
restriction" component by naturality of `φ`. -/
theorem chi_pullbackTrue {A : Psh} (φ : Hom A Omega) : chi (pullbackTrue φ) = φ := by
apply Hom.ext
· funext x
apply Subtype.ext
show ((φ.f1 x = top1), φ.f0 (A.res x)) = (φ.f1 x).1
rw [← φ.comm x]
apply Prod.ext
· exact propext (eq_top1_iff (φ.f1 x))
· rfl
· rfl/-- **`Ω` classifies subobjects**: subpresheaves of `A` are in bijection with natural maps
`A ⟶ Ω`, via `χ` and pulling back `true`. This is the subobject-classifier axiom for the
Sierpiński topos, in the form "`Sub(A) ≅ Hom(A, Ω)`". -/
def subEquivHom (A : Psh) : Sub A ≃ Hom A Omega where
toFun := chi
invFun := pullbackTrue
left_inv := pullbackTrue_chi
right_inv := chi_pullbackTrueTheorem 4 for this topos: Heyting implication is defined with the "now and after restriction" clause, the residuation law is proved, and Mathlib's HeytingAlgebra.ofHImp packages the result as a genuine HeytingAlgebra instance — so all of Mathlib's Heyting-algebra lemmas apply to subpresheaves.
/-- **Heyting implication** of subpresheaves. At stage `0` it is the usual
`{y | y ∈ S → y ∈ T}`. At stage `1`, a section `x` belongs to `S ⇒ T` when the implication holds
*at every stage reachable from `x`*: now, and after restriction. This is the Kripke clause for
implication; the second conjunct is exactly what makes the result closed under restriction. -/
def himp (S T : Sub A) : Sub A where
S1 := {x | (x ∈ S.S1 → x ∈ T.S1) ∧ (A.res x ∈ S.S0 → A.res x ∈ T.S0)}
S0 := {y | y ∈ S.S0 → y ∈ T.S0}
closed _ hx := hx.2/-- The **residuation law** `U ≤ (S ⇒ T) ↔ U ⊓ S ≤ T`, which makes subpresheaves a Heyting
algebra. The forward direction is modus ponens. For the backward direction at stage `1`, the
"after restriction" clause uses that `U` itself is closed under restriction. -/
theorem le_himp_iff (U S T : Sub A) : U ≤ himp S T ↔ U ⊓ S ≤ T := by
constructor
· rintro ⟨h1, h0⟩
exact ⟨fun x hx => (h1 hx.1).1 hx.2, fun y hy => h0 hy.1 hy.2⟩
· rintro ⟨h1, h0⟩
refine ⟨fun x hx => ⟨fun hs => h1 ⟨hx, hs⟩, fun hs => h0 ⟨U.closed x hx, hs⟩⟩,
fun y hy hs => h0 ⟨hy, hs⟩⟩/-- **The subobjects of any presheaf on `{0 < 1}` form a Heyting algebra.** Negation is
`¬S = S ⇒ ⊥`. -/
instance instHeytingAlgebra : HeytingAlgebra (Sub A) :=
HeytingAlgebra.ofHImp himp le_himp_iffProposition 5: three truth values, a subobject without complement, and a truth value that is "not not true" without being true.
/-- The terminal presheaf has **exactly three subobjects**: `⊥`, `later` and `⊤` (the case split
on two propositions uses classical logic, as it must: this is a statement *about* the topos, made
in our classical metatheory). -/
theorem sub_one_trichotomy (S : Sub one) : S = ⊥ ∨ S = later ∨ S = ⊤ := by
by_cases h1 : () ∈ S.S1
· right; right
have h0 : () ∈ S.S0 := S.closed () h1
ext ⟨⟩
· exact ⟨fun _ => trivial, fun _ => h1⟩
· exact ⟨fun _ => trivial, fun _ => h0⟩
· by_cases h0 : () ∈ S.S0
· right; left
ext ⟨⟩
· exact ⟨fun h => (h1 h).elim, fun h => h.elim⟩
· exact ⟨fun _ => trivial, fun _ => h0⟩
· left
ext ⟨⟩
· exact ⟨fun h => (h1 h).elim, fun h => h.elim⟩
· exact ⟨fun h => (h0 h).elim, fun h => h.elim⟩/-- **The Sierpiński topos is not Boolean.** The subobject `later` of `1` has no complement: no
`T` with `later ⊓ T = ⊥` and `later ⊔ T = ⊤`. (Disjointness forces `T` to be empty at stage `0`,
closure then forces it to be empty at stage `1`, and then the union misses stage `1`.) -/
theorem sub_one_not_boolean : ¬ ∃ T : Sub one, later ⊓ T = ⊥ ∧ later ⊔ T = ⊤ := by
rintro ⟨T, hinf, hsup⟩
have hT0 : () ∉ T.S0 := fun h => by
have : () ∈ (later ⊓ T).S0 := ⟨trivial, h⟩
rw [hinf] at this
exact this
have hT1 : () ∉ T.S1 := fun h => hT0 (T.closed () h)
have : () ∈ (later ⊔ T).S1 := by
rw [hsup]
trivial
rcases this with h | h
· exact h
· exact hT1 h/-- Yet `later` is "not not true": its double negation is `⊤`, while `later ≠ ⊤`. So
`¬¬p → p` fails too — a hallmark of intuitionistic logic. -/
theorem not_not_later : laterᶜᶜ = ⊤ ∧ later ≠ ⊤ := by
refine ⟨?_, fun h => ?_⟩
· apply le_antisymm le_top
rw [le_compl_iff_disjoint_right, disjoint_iff]
-- `laterᶜ` is empty at stage `0` (since `later` is full there) and hence at stage `1`.
ext ⟨⟩
· exact ⟨fun hx => (hx.2.2 trivial).elim, fun hx => hx.elim⟩
· exact ⟨fun hx => hx.2 trivial, fun hx => hx.elim⟩
· have : () ∈ (⊤ : Sub one).S1 := trivial
rw [← h] at this
exact thisThe axiom lists shown with each declaration are instructive: the classifier bijection and not_not_later use only propext and Quot.sound, not Classical.choice, while the trichotomy — a statement about the topos, made in our classical metatheory — needs a classical case split on two propositions and so depends on Classical.choice.
Finally, Mathlib proves the general Theorem 3: every presheaf category on a small category has finite limits, a subobject classifier (built, as in our proof, from the presheaf of sieves) and internal homs for the pointwise product.
/-- **Every presheaf category on a small category is an elementary topos**: it has finite limits,
a subobject classifier (Mathlib's `HasSubobjectClassifier` instance from
`Mathlib.CategoryTheory.Topos.Sheaf`, whose `Ω` is the presheaf of sieves), and internal homs
(`MonoidalClosed`, from `Mathlib.CategoryTheory.Monoidal.Closed.FunctorToTypes`) for the pointwise
product — which is the categorical product, see `presheaf_tensor_eq_prod`. All three are
instances found by `inferInstance`. -/
theorem presheaf_category_is_topos (C : Type u) [SmallCategory C] :
HasFiniteLimits (Cᵒᵖ ⥤ Type u) ∧ HasSubobjectClassifier (Cᵒᵖ ⥤ Type u) ∧
Nonempty (MonoidalClosed (Cᵒᵖ ⥤ Type u)) :=
⟨inferInstance, inferInstance, ⟨inferInstance⟩⟩The closed structure is with respect to Mathlib's monoidal structure on functor categories, which is the pointwise cartesian product — so this is cartesian closure:
/-- The monoidal product used by the closed structure above is the pointwise cartesian product:
`(F ⊗ G)(c) = F(c) × G(c)`, by definition of Mathlib's monoidal structure on functor categories.
Mathlib also makes it a `CartesianMonoidalCategory` (chosen finite products), so `MonoidalClosed`
here is cartesian closedness. -/
theorem presheaf_tensor_eq_prod (C : Type u) [SmallCategory C] (F G : Cᵒᵖ ⥤ Type u) (c : Cᵒᵖ) :
(F ⊗ G).obj c = (F.obj c × G.obj c) :=
rflWhat is and is not formalised. Formalised: the Sierpiński classifier (independently), the Heyting algebra of subpresheaves on and its failure to be Boolean (independently), and Theorem 3 in general (from Mathlib). Not formalised here: our concrete Psh is not proved equivalent to Mathlib's functor category on ; Theorem 4 for arbitrary presheaf categories; the Heyting algebra of subobjects in an arbitrary topos and the internal language (Mathlib has the lattice of subobjects in a general category, Subobject B, but we found no Heyting structure or internal language for toposes); and ETCS.
Computing truth values
For presheaves on a finite poset everything is finite and can be computed: the sieves , the subpresheaves of a small presheaf, all natural maps into , and the Heyting operations on truth values. The experiment checks the classifier bijection of Theorem 3 for every presheaf on with at most four sections at stage 1 and three at stage 0, and finds which posets give Boolean truth values.
"""The subobject classifier of a presheaf topos, computed exactly.
For presheaves on a finite poset P, the classifier Omega has Omega(p) = the
sieves on p (down-closed subsets of the principal down-set of p), and the
global truth values are the down-sets of P. This experiment
1. counts sieves on a chain (|Omega(k)| = k + 2) and on other small posets;
2. checks, for every presheaf A on {0 < 1} with |A1| <= 4 and |A0| <= 3,
that A has exactly as many subpresheaves as natural maps A -> Omega, and
that the characteristic map chi is a bijection between them;
3. computes the Heyting algebra of truth values and finds where excluded
middle fails.
Evidence: exact computation and exhaustive checks of finitely many cases.
"""
import itertools
import textwrap
def down_sets(elements, leq):
"""All down-closed subsets of the finite poset (elements, leq)."""
found = []
for r in range(len(elements) + 1):
for combo in itertools.combinations(elements, r):
s = frozenset(combo)
if all(q in s for p in s for q in elements if leq(q, p)):
found.append(s)
return found
def sieves_on(p, elements, leq):
"""Sieves on p: down-closed subsets of {q | q <= p}."""
below = [q for q in elements if leq(q, p)]
return down_sets(below, leq)
def chain(n):
"""The chain 0 < 1 < ... < n-1 as (elements, leq)."""
return list(range(n)), lambda a, b: a <= b
def heyting_implies(u, v, opens):
"""Largest member w of `opens` with w & u <= v (the Heyting implication)."""
best = frozenset()
for w in opens:
if w & u <= v:
best = best | w
assert best in opens
return best
def excluded_middle_failures(elements, leq):
"""Down-sets u with u | (not u) != everything, where not u = u => empty."""
opens = down_sets(elements, leq)
top = frozenset(elements)
return [u for u in opens
if u | heyting_implies(u, frozenset(), opens) != top]
OMEGA1 = [(a, b) for a in (False, True) for b in (False, True) if a <= b]
def subpresheaves(a1, a0, res):
"""Pairs (S1, S0) of subsets with res(S1) inside S0."""
subs = []
for r0 in range(a0 + 1):
for s0 in itertools.combinations(range(a0), r0):
for r1 in range(a1 + 1):
for s1 in itertools.combinations(range(a1), r1):
if all(res[x] in s0 for x in s1):
subs.append((frozenset(s1), frozenset(s0)))
return subs
def natural_maps(a1, a0, res):
"""Natural maps A -> Omega: (f1, f0) with f1(x)[1] == f0(res x)."""
maps = []
for f0 in itertools.product((False, True), repeat=a0):
for f1 in itertools.product(OMEGA1, repeat=a1):
if all(f1[x][1] == f0[res[x]] for x in range(a1)):
maps.append((f1, f0))
return maps
def chi(sub, a1, a0, res):
"""Characteristic map of a subpresheaf (S1, S0)."""
s1, s0 = sub
f1 = tuple((x in s1, res[x] in s0) for x in range(a1))
return f1, tuple(y in s0 for y in range(a0))
def check_classifier(max1=4, max0=3):
"""Return (presheaves checked, failures) for the bijection Sub = Hom."""
checked, failures = 0, []
for a1 in range(max1 + 1):
for a0 in range(max0 + 1):
for res in itertools.product(range(a0), repeat=a1):
subs = subpresheaves(a1, a0, res)
maps = set(natural_maps(a1, a0, res))
images = {chi(s, a1, a0, res) for s in subs}
if len(images) != len(subs) or images != maps:
failures.append((a1, a0, res))
checked += 1
return checked, failures
POSETS = {
"{0<1}": chain(2),
"chain of 3": chain(3),
"0 < 2 > 1": ([0, 1, 2], lambda a, b: a == b or b == 2),
"discrete 3": ([0, 1, 2], lambda a, b: a == b),
}
def main():
elems, leq = chain(5)
sizes = [len(sieves_on(k, elems, leq)) for k in elems]
print(f"Chain 0<1<2<3<4: |Omega(k)| = {sizes} (k + 2 each)")
print()
checked, failures = check_classifier()
print("Presheaves A on {0<1} with |A1| <= 4, |A0| <= 3 (all restrictions):")
print(f" {checked} presheaves; chi : Sub(A) -> Hom(A, Omega) failed to be a")
print(f" bijection in {len(failures)} of them.")
a1, a0, res = 3, 2, (0, 0, 1)
n_sub = len(subpresheaves(a1, a0, res))
print(f" Example res = {res}: {n_sub} subpresheaves = (1 + 2^2)(1 + 2^1).")
print()
print("Global truth values = down-sets of P:")
for name, (el, le) in POSETS.items():
opens = down_sets(el, le)
bad = excluded_middle_failures(el, le)
status = "Boolean" if not bad else f"not Boolean ({len(bad)} fail LEM)"
print(f" {name:<12} {len(opens):>2} truth values, {status}")
el, le = chain(2)
opens = down_sets(el, le)
half = frozenset({0})
neg = heyting_implies(half, frozenset(), opens)
negneg = heyting_implies(neg, frozenset(), opens)
print("In {0<1}: u = {0} ('true only after restriction'):")
print(f" not u = {sorted(neg)}, not not u = {sorted(negneg)},"
f" u or not u = {sorted(half | neg)}")
print()
print(textwrap.fill(
"Epistemic status: exact computations and an exhaustive check of "
f"{checked} small presheaves. They illustrate, but do not prove, the "
"theorems that Omega classifies subobjects in every presheaf topos "
"and that its truth values form a Heyting algebra; those are proved "
"in the lesson, and the {0<1} case is also checked in Lean.",
width=78,
))
if __name__ == "__main__":
main()Two things to notice. The number of subpresheaves of — and hence, by the bijection, of natural maps — is , where is the size of the fibre of over (see the exercises). And among the posets tried only the discrete one gives a Boolean algebra of truth values. This is always so: the only possible complement of a down-set is , and if then contains but not , so it is not a down-set and has no complement. The computation is exhaustive only for the listed finite cases; the theorems above are what cover all presheaves.
Classical tautologies under three truth values
The truth-table explorer below computes classical (two-valued) truth tables — the logic of the Boolean topos . Both formulas are classical tautologies, so their columns agree.
Two classical tautologies
Type a formula of propositional logic and see its value in every possible case.
Read as: ¬¬(p ∨ ¬p)
Read as: p ∨ ¬p
Use the symbols ¬ ∧ ∨ → ↔, the words not, and, or, implies, iff, or ASCII ~ & | -> <->. Variables are single lowercase letters. ¬ binds tightest, then ∧, ∨, →, ↔; p → q → r means p → (q → r).
Tautology — true in all 2 rows.
Equivalent — the two formulas agree in all 2 rows.
| p | ¬p | p ∨ ¬p | ¬(p ∨ ¬p) | ¬¬(p ∨ ¬p) | p ∨ ¬p | Rows where they differ |
|---|---|---|---|---|---|---|
| T | F | T | F | T | T | |
| F | T | T | F | T | T |
2 rows: one for every way of making the 1 variables true or false.
In the Sierpiński topos the truth values form the chain , where if and otherwise, and :
Try other formulas in the explorer and then evaluate them by hand on the three-element chain. Peirce's law is a classical tautology that fails at , . The weak De Morgan law survives on the chain, but fails for presheaves on the poset (take , to be the down-sets and ). In the other direction, a formula that is not a classical tautology already fails at the truth values and of any non-degenerate topos.
Exercises
1. Elementary topos theory
Warm-upHumanConsider presheaves on the chain (one arrow whenever ). How many sieves are there on the object , i.e. how many elements does have?
2. Elementary topos theory
CoreHumanA presheaf on has , and , . How many subpresheaves does it have? (Recall: , and .)
3. Elementary topos theory
CoreHumanIn the Sierpiński topos the truth values form the chain , with if and otherwise, and . Which formulas take the value for every truth value of ? (Choose all that apply.)
4. Elementary topos theory
CoreHumanWhy is the category of groups not an elementary topos?
5. Elementary topos theory
StretchHumanLet and consider the topos of sets with a -action. Which statement is true?
6. Elementary topos theory
CoreFormalIn the lesson's Lean file, chi S : Hom A Omega is the characteristic map of a subpresheaf S : Sub A, and pullbackTrue φ : Sub A pulls true back along φ. Which statement expresses the full subobject-classifier property (existence and uniqueness of characteristic maps)?
7. Elementary topos theory
StretchHumanIn the uniqueness part of Theorem 3 we wrote, for and : . What justifies the middle equivalence ?
8. Elementary topos theory
CoreHumanWhich statements about ETCS (Lawvere's Elementary Theory of the Category of Sets) are true? (Choose all that apply.)
9. Elementary topos theory
StretchComputationalThe truth values of a presheaf topos on a finite poset are its down-sets. Represent them as a list opens of frozensets (closed under unions and intersections). Write negation(u, opens), returning the Heyting negation — the largest member of opens disjoint from u — and is_boolean(opens, top), returning True exactly when u | negation(u, opens) == top for every u in opens.
Common misconceptions
Misconception
"A topos is a kind of topological space." Every space gives a topos , and for sober spaces can be recovered from it. But many toposes are not of this form. In for a non-trivial group , the terminal object has only two subobjects, so if it were the frame would be and the topos would be — but is a non-initial -set with no global element, which is impossible in . Toposes generalise spaces (and even locales), not the other way round; and elementary toposes such as or Hyland's effective topos are not Grothendieck toposes at all.
Misconception
"The internal logic of every topos is classical, because that of is." The internal logic is intuitionistic in general: in the Sierpiński topos, and in , excluded middle fails for some truth values. Boolean toposes (such as and ) are the special case.
Misconception
"Intuitionistic logic says excluded middle is false." It does not assume excluded middle; it does not refute it. holds in every topos, and is a topos where holds outright.
Misconception
"A topos is a model of ZFC." An elementary topos need not even be well-pointed or have a natural numbers object. The toposes that model set theory à la Lawvere are the well-pointed ones with a natural numbers object and choice (ETCS), a theory equiconsistent with bounded Zermelo set theory — strictly weaker than ZFC.
Viewpoints
Topology— Truth values are open sets
In the truth value of a proposition about sections is the open set where it holds, and . Only the frame of opens matters: depends on only through , so toposes see locales — "spaces without points" — rather than point-set spaces. A point of a topos is a geometric morphism ; for a sober space, the points of are exactly the points of . The topos is Boolean exactly when is a Boolean algebra, i.e. every open set is closed — for , connectedness rules this out. See sheaves and point-set topology.
Geometry— Grothendieck: a topos is a generalised space
Grothendieck, with Artin and Verdier in SGA 4, introduced toposes so that a space could be replaced by its category of sheaves — and then generalised to sites that are not spaces at all. For a scheme , the étale site (étale maps , covered by jointly surjective families) gives the étale topos , whose sheaf cohomology with -adic coefficients was the tool for the Weil conjectures, completed by Deligne (1974). Morphisms of these generalised spaces are geometric morphisms , adjoint pairs with preserving finite limits; a continuous map induces one , and cohomology is defined for every topos as the derived functors of global sections. See algebraic geometry.
Algebra— Classifying toposes
Many algebraic theories have a classifying topos: a Grothendieck topos such that models of the theory in any Grothendieck topos correspond (naturally in ) to geometric morphisms . The functor category classifies objects; the functor category from finitely presented commutative rings to sets classifies commutative rings (a ring in is a sheaf of rings, so ringed spaces are geometric morphisms into it); and classifies -torsors, so geometric morphisms are principal -bundles on for a discrete group — a topos-theoretic . Olivia Caramello's programme of "toposes as bridges" exploits the fact that one topos may classify several theories.
Logic— Kripke models and forcing
Presheaves on a poset are Kripke models of intuitionistic logic, and the Kripke–Joyal semantics extends the forcing clauses to the whole internal language of any topos. Forcing itself is topos-theoretic: for a poset of conditions, the sheaves on for the dense ("double negation") topology form a Boolean topos. Tierney (1972) used Cohen's poset to build a topos in which the continuum hypothesis fails, a topos-theoretic version of Cohen's independence proof; see forcing.
Computation— The effective topos
Martin Hyland's effective topos (1982) is built from Kleene's realizability: a proposition is true when some program computes a witness for it. Its natural numbers object is the usual , but internally every function is computable — Church's thesis holds as an internal statement — and the topos is not Boolean (excluded middle for the halting problem has no realizer). It is an elementary topos that is not a Grothendieck topos, and a model for constructive mathematics in which computability is built in.
Set theory— Structural set theory
From the set-theoretic side, ETCS is a structural set theory: the theory of a well-pointed topos with a natural numbers object and choice. It is equiconsistent with bounded Zermelo set theory with choice, while never asking whether one set is an element of another. Lawvere's view is that this is how sets are actually used; the comparison with ZFC above makes precise what is gained and lost.
History and global context
- Grothendieck toposes (1960s). Alexander Grothendieck introduced sites, sheaves on sites and toposes in his Séminaire de Géométrie Algébrique at the IHÉS near Paris; the theory was written up with Michael Artin and Jean-Louis Verdier in SGA 4 (seminar 1963–64, published 1972–73), as the foundation for étale cohomology. The word topos is Grothendieck's.
- ETCS (1964). F. William Lawvere's "An elementary theory of the category of sets" axiomatised sets through functions alone.
- Elementary toposes (1969–70). Lawvere and Myles Tierney, working together in Halifax, isolated the axioms of an elementary topos; Lawvere presented them in his address "Quantifiers and sheaves" at the 1970 International Congress in Nice. Tierney's "Sheaf theory and the continuum hypothesis" (1972) recast Cohen's forcing in topos language.
- The 1970s. Peter Freyd ("Aspects of topoi", 1972), Robert Paré (finite colimits, 1974), Radu Diaconescu (choice implies excluded middle, 1975), William Mitchell, J. C. Cole and Gerhard Osius (comparisons with set theory), André Joyal (Kripke–Joyal semantics) and many others built the subject; Peter Johnstone's Topos Theory (1977) and Robert Goldblatt's Topoi (1979) made it teachable.
- Since then. Martin Hyland's effective topos (1982), Joyal and Tierney's Galois theory of toposes (1984), Mac Lane and Moerdijk's textbook (1992), Johnstone's Elephant (2002), Caramello's work on classifying toposes, and the extension to -toposes (see ∞-categories), which model homotopy type theory. Research groups across Europe, the Americas and Australia (notably the Sydney category theory seminar) have shaped the field.
Further reading
- Saunders Mac Lane and Ieke Moerdijk, Sheaves in Geometry and Logic: A First Introduction to Topos Theory (1992) — the standard course text; Chapters I, III, IV and VI cover this lesson.
- Robert Goldblatt, Topoi: The Categorial Analysis of Logic (1979; revised 1984) — gentle and logic-oriented, including ETCS and Kripke semantics.
- Peter T. Johnstone, Sketches of an Elephant: A Topos Theory Compendium (2002) — the reference work.
- F. William Lawvere, "An elementary theory of the category of sets", Proceedings of the National Academy of Sciences 52 (1964); and F. William Lawvere and Robert Rosebrugh, Sets for Mathematics (2003).
- Tom Leinster, "Rethinking set theory", American Mathematical Monthly 121 (2014) — ETCS in ten informal axioms.
- J. L. Bell, Toposes and Local Set Theories (1988), and J. Lambek and P. J. Scott, Introduction to Higher Order Categorical Logic (1986), for the internal language.
- Olivia Caramello, Theories, Sites, Toposes (2017), for classifying toposes.
Reading path: Goldblatt or Leinster first, then Mac Lane–Moerdijk, then the Elephant as needed.