Skip to content
The Lumenary
First-year graduateGraduate 130 min

Elementary topos theory

Categories that behave like the universe of sets — with finite limits, function sets and an object of truth values — in which truth can be partial and logic becomes intuitionistic.

Formally verified · 16 LeanComputationally tested · 1 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

What is special about sets?

Almost all of mathematics can be carried out inside the category Set\cat{Set} of sets and functions. Which features of Set\cat{Set} does it actually use? Three stand out:

  1. we can form finite limits — products, solution sets of equations, inverse images;
  2. we can form function sets YXY^X, and functions of two variables correspond to functions into function sets;
  3. subsets are the same as predicates: a subset A⊆XA \subseteq X is the same thing as its characteristic function χA:X→{0,1}\chi_A : X \to \{0, 1\}.

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 N→N\N \to \N 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.

IntuitionH

Truth values that are not just true or false

Take a very small space, the Sierpiński space S={a,b}S = \{a, b\} whose open sets are ∅⊂{a}⊂S\varnothing \subset \{a\} \subset S. A sheaf FF on SS amounts to a set F(S)F(S) of global sections, a set F({a})F(\{a\}) of sections over the open point, and a restriction map F(S)→F({a})F(S) \to F(\{a\}). (The empty open set contributes a single section, and no cover of SS omits SS itself, so there is no gluing condition.)

So consider a set A1A_1 ("sections over the whole space"), a set A0A_0 ("sections over the open point") and a map res:A1→A0\mathrm{res} : A_1 \to A_0, together with a sub-collection: subsets S1⊆A1S_1 \subseteq A_1 and S0⊆A0S_0 \subseteq A_0 with res(S1)⊆S0\mathrm{res}(S_1) \subseteq S_0. For a global section x∈A1x \in A_1, how true is "x∈Sx \in S"? There are three possibilities:

  • x∈S1x \in S_1: true everywhere;
  • x∉S1x \notin S_1 but res(x)∈S0\mathrm{res}(x) \in S_0: true on the open point {a}\{a\} only;
  • res(x)∉S0\mathrm{res}(x) \notin S_0: true nowhere.

The truth value of "x∈Sx \in S" is the open set on which it holds: SS, {a}\{a\} or ∅\varnothing. In Set\cat{Set} — sheaves on a one-point space — only "everywhere" and "nowhere" are possible, and we get the familiar two truth values.

stage 1stage 0abcxyres
A presheaf on 0 < 1: three sections a, b, c at stage 1 restrict to sections x, y at stage 0. The sub-presheaf S (filled) contains a and x. Then 'a is in S' is true, 'b is in S' is true only after restriction (b is not in S, but its restriction x is), and 'c is in S' is false.

Topos theory takes this seriously: an object Ω\Omega 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.

DefinitionsH

Definitions

Throughout, E\mathcal{E} is a category with finite limits; 11 denotes a terminal object.

Definition— subobject

A subobject of XX is an isomorphism class of monomorphisms m:U↣Xm : U \rightarrowtail X, where m≅m′m \cong m' when m′=m∘θm' = m \circ \theta for an isomorphism θ\theta. Subobjects of XX form a poset Sub(X)\mathrm{Sub}(X), ordered by factorisation. Pulling back along f:Y→Xf : Y \to X gives a monotone map f∗:Sub(X)→Sub(Y)f^* : \mathrm{Sub}(X) \to \mathrm{Sub}(Y).

Definition— subobject classifier

A subobject classifier is an object Ω\Omega with an arrow true:1→Ω\mathrm{true} : 1 \to \Omega such that for every monomorphism m:U↣Xm : U \rightarrowtail X there is a unique arrow χm:X→Ω\chi_m : X \to \Omega for which the square below is a pullback. Equivalently, Sub(X)≅E(X,Ω)\mathrm{Sub}(X) \cong \mathcal{E}(X, \Omega), naturally in XX: the functor Sub:Eop→Set\mathrm{Sub} : \mathcal{E}^{\mathrm{op}} \to \cat{Set} is representable, represented by Ω\Omega.

UU
11
XX
Ω\Omega
!!
mm
true\mathrm{true}
χm\chi_m
The subobject classifier: every mono mm is the pullback of true\mathrm{true} along exactly one χm\chi_m.

Definition— elementary topos

An elementary topos is a category E\mathcal{E} that

  1. has all finite limits,
  2. is cartesian closed: every functor −×X- \times X has a right adjoint (−)X(-)^X, so E(Z×X,Y)≅E(Z,YX)\mathcal{E}(Z \times X, Y) \cong \mathcal{E}(Z, Y^X) naturally, and
  3. has a subobject classifier true:1→Ω\mathrm{true} : 1 \to \Omega.
Z×XZ \times X
YX×XY^X \times X
YY
λf×id\lambda f \times \mathrm{id}
ev\mathrm{ev}
ff
Cartesian closure: each f:Z×X→Yf : Z \times X \to Y factors through evaluation by a unique λf:Z→YX\lambda f : Z \to Y^X.

Combining (2) and (3) gives power objects PX=ΩXPX = \Omega^X with Sub(Z×X)≅E(Z,PX)\mathrm{Sub}(Z \times X) \cong \mathcal{E}(Z, PX); 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 P=Ω(−):Eop→EP = \Omega^{(-)} : \mathcal{E}^{\mathrm{op}} \to \mathcal{E} is monadic.

Definition— Boolean topos

A topos is Boolean if every subobject U↣XU \rightarrowtail X has a complement: some VV with U∧V=0U \wedge V = 0 and U∨V=XU \vee V = X in Sub(X)\mathrm{Sub}(X). Equivalently, [true,false]:1+1→Ω[\mathrm{true}, \mathrm{false}] : 1 + 1 \to \Omega is an isomorphism, where false\mathrm{false} classifies 0↣10 \rightarrowtail 1.

Definition— presheaf; sieve

For a small category C\cat{C}, a presheaf is a functor X:Cop→SetX : \cat{C}^{\mathrm{op}} \to \cat{Set}; for f:d→cf : d \to c we write X(f):X(c)→X(d)X(f) : X(c) \to X(d), x↦x⋅fx \mapsto x \cdot f ("restriction along ff"). A sieve on cc is a set SS of arrows with codomain cc that is closed under precomposition: f∈Sf \in S implies f∘g∈Sf \circ g \in S. For h:c′→ch : c' \to c, the pullback of SS is the sieve h∗S={g:d→c′∣h∘g∈S}h^*S = \{ g : d \to c' \mid h \circ g \in S \} on c′c'. The maximal sieve tct_c consists of all arrows into cc.

Definition— Grothendieck topology; Grothendieck topos

A Grothendieck topology JJ on C\cat{C} assigns to each object cc a set J(c)J(c) of "covering" sieves such that the maximal sieve covers, covers are stable under pullback (S∈J(c)⇒h∗S∈J(c′)S \in J(c) \Rightarrow h^*S \in J(c')), and covering is local (if S∈J(c)S \in J(c) and RR is a sieve on cc with f∗R∈J(d)f^*R \in J(d) for all f:d→cf : d \to c in SS, then R∈J(c)R \in J(c)). A presheaf XX is a sheaf if, for every covering sieve SS on cc, every compatible family (xf∈X(d))f:d→c∈S(x_f \in X(d))_{f : d \to c \in S} — one with xf⋅g=xf∘gx_f \cdot g = x_{f \circ g} — is (x⋅f)f(x \cdot f)_f for exactly one x∈X(c)x \in X(c). A Grothendieck topos is a category equivalent to the category Sh(C,J)\mathrm{Sh}(\cat{C}, J) of sheaves on a small site.

Definition— natural numbers object

A natural numbers object is a diagram 1→0N→sN1 \xrightarrow{0} N \xrightarrow{s} N such that for every 1→aA→uA1 \xrightarrow{a} A \xrightarrow{u} A there is a unique h:N→Ah : N \to A with h∘0=ah \circ 0 = a and h∘s=u∘hh \circ s = u \circ h — definition by recursion, as an axiom.

Worked examplesH

Examples and non-examples

Example— Sets

Set\cat{Set} is a topos with Ω={0,1}\Omega = \{0, 1\} and true=1\mathrm{true} = 1 (proved below). It is Boolean and has a natural numbers object N\N. The category FinSet\cat{FinSet} of finite sets is also a topos — same Ω\Omega, finite function sets — but has no natural numbers object.

Example— Sets with a group action

For a group GG, the category G-SetG\text{-}\cat{Set} of left GG-sets is the presheaf category on the one-object category with arrows the elements of GG (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 Ω={0,1}\Omega = \{0, 1\} with the trivial action, and G-SetG\text{-}\cat{Set} is Boolean. Yet for G≠1G \neq 1 it is not equivalent to Set\cat{Set}: the epimorphism G→1G \to 1 (GG acting on itself) has no section, because a section would pick a point of GG 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 2={0<1}\mathbf{2} = \{0 < 1\} (viewed as a category with one arrow 0→10 \to 1) are exactly the triples (A1,A0,res:A1→A0)(A_1, A_0, \mathrm{res} : A_1 \to A_0) 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 00: ∅\varnothing and {id0}\{\mathrm{id}_0\}, so Ω(0)\Omega(0) has 2 elements;
  • sieves on 11: ∅\varnothing, {0→1}\{0 \to 1\} and {0→1,id1}\{0 \to 1, \mathrm{id}_1\}, so Ω(1)\Omega(1) has 3 elements;
  • restriction Ω(1)→Ω(0)\Omega(1) \to \Omega(0) pulls back along 0→10 \to 1: ∅↦∅\varnothing \mapsto \varnothing, while both non-empty sieves go to {id0}\{\mathrm{id}_0\}.

The three elements of Ω(1)\Omega(1) 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 XX, Sh(X)\mathrm{Sh}(X) — sheaves on the site of open sets, covered by open covers — is a Grothendieck topos. Its subobject classifier is Ω(U)={V⊆U open}\Omega(U) = \{ V \subseteq U \text{ open} \} with restriction V↦V∩U′V \mapsto V \cap U'. For a subsheaf A⊆FA \subseteq F and s∈F(U)s \in F(U), χ(s)\chi(s) is the largest open subset of UU on which ss belongs to AA (the union of all such opens; the restrictions of ss glue inside AA because AA is a sheaf). The global truth values Sub(1)≅O(X)\mathrm{Sub}(1) \cong \mathcal{O}(X) form the frame of open sets, whose Heyting negation is ¬V=int⁡(X∖V)\neg V = \operatorname{int}(X \setminus V). So for X=RX = \R and V=(0,∞)V = (0, \infty) we get V∨¬V=R∖{0}V \vee \neg V = \R \setminus \{0\}: excluded middle fails on the open set of truth values.

Example— Non-examples

  • Grp\cat{Grp}: the trivial group is both initial and terminal. In any topos the initial object is strict (every arrow into 00 is an isomorphism), so 0≅10 \cong 1 would make every arrow X→1≅0X \to 1 \cong 0 an isomorphism and every object initial. Hence a topos with 0≅10 \cong 1 is trivial, and Grp\cat{Grp} is not a topos.
  • Pos\cat{Pos} (posets and monotone maps) is cartesian closed but not a topos: the identity function from the two-element discrete poset to the chain 0<10 < 1 is monic and epic but not an isomorphism, whereas every topos is balanced (monic + epic implies iso, since every mono is the equaliser of χm\chi_m and true∘!\mathrm{true} \circ {!}).
  • Top\cat{Top} is not even cartesian closed: −×Q- \times \mathbb{Q} does not preserve all quotients, so it cannot be a left adjoint.
ProofH

Set and presheaf categories are toposes

Theorem— Theorem 1 (Set is a topos)

Set\cat{Set} is an elementary topos, with subobject classifier true=1:{∗}→{0,1}\mathrm{true} = 1 : \{*\} \to \{0, 1\}.

Proof

Finite limits: the one-point set is terminal, X×YX \times Y is a product, and {(x,y)∣f(x)=g(y)}\{(x, y) \mid f(x) = g(y)\} is a pullback of f:X→Z←Y:gf : X \to Z \leftarrow Y : g. Exponentials: let YXY^X be the set of all functions X→YX \to Y; a function f:Z×X→Yf : Z \times X \to Y corresponds to λf(z)=f(z,−)\lambda f(z) = f(z, -), and this is a bijection natural in ZZ (currying). Classifier: monomorphisms in Set\cat{Set} are injections, and m:U↣Xm : U \rightarrowtail X is isomorphic to the inclusion of its image A=m(U)A = m(U). Define χ(x)=1\chi(x) = 1 if x∈Ax \in A and 00 otherwise. The pullback of true\mathrm{true} along χ\chi is {x∣χ(x)=1}=A\{x \mid \chi(x) = 1\} = A, so the square is a pullback. If ϕ:X→{0,1}\phi : X \to \{0, 1\} also has pullback AA, then ϕ(x)=1  ⟺  x∈A  ⟺  χ(x)=1\phi(x) = 1 \iff x \in A \iff \chi(x) = 1, so ϕ=χ\phi = \chi, since {0,1}\{0,1\} has only two elements.

∎

Now fix a small category C\cat{C} and write C^=[Cop,Set]\widehat{\cat{C}} = [\cat{C}^{\mathrm{op}}, \cat{Set}] and y:C→C^y : \cat{C} \to \widehat{\cat{C}} for the Yoneda embedding, y(c)=C(−,c)y(c) = \cat{C}(-, c).

Theorem— Lemma 2 (subobjects of presheaves)

A natural transformation m:U→Xm : U \to X in C^\widehat{\cat{C}} is a monomorphism if and only if every component mcm_c is injective. Hence Sub(X)\mathrm{Sub}(X) is isomorphic to the poset of subpresheaves of XX: families U(c)⊆X(c)U(c) \subseteq X(c) closed under restriction.

Proof

If every mcm_c is injective, mm is clearly monic. Conversely let mm be monic and u,v∈U(c)u, v \in U(c) with mc(u)=mc(v)m_c(u) = m_c(v). By Yoneda, uu and vv correspond to natural transformations u^,v^:y(c)→U\hat u, \hat v : y(c) \to U, and m∘u^m \circ \hat u, m∘v^m \circ \hat v correspond to mc(u)=mc(v)m_c(u) = m_c(v), so m∘u^=m∘v^m \circ \hat u = m \circ \hat v. Since mm is monic, u^=v^\hat u = \hat v, i.e. u=vu = v. Finally, a pointwise injective mm is isomorphic to the inclusion of its image, which is a subpresheaf by naturality.

∎

Theorem— Theorem 3 (presheaf categories are toposes)

C^\widehat{\cat{C}} is an elementary topos. Its subobject classifier is the presheaf of sieves: Ω(c)\Omega(c) is the set of sieves on cc, Ω(h)(S)=h∗S\Omega(h)(S) = h^*S, and truec=tc\mathrm{true}_c = t_c is the maximal sieve. The characteristic map of a subpresheaf U⊆XU \subseteq X is

χc(x)={ f:d→c∣x⋅f∈U(d) }.\chi_c(x) = \{\, f : d \to c \mid x \cdot f \in U(d) \,\}.

Proof

Finite limits are computed objectwise: (X×ZY)(c)=X(c)×Z(c)Y(c)(X \times_Z Y)(c) = X(c) \times_{Z(c)} Y(c), with the evident restriction maps, has the universal property because a cone in C^\widehat{\cat{C}} is a cone at every object, naturally.

Exponentials. If YXY^X exists, Yoneda forces YX(c)≅C^(y(c),YX)≅C^(y(c)×X,Y)Y^X(c) \cong \widehat{\cat{C}}(y(c), Y^X) \cong \widehat{\cat{C}}(y(c) \times X, Y). Defining YX(c)=C^(y(c)×X,Y)Y^X(c) = \widehat{\cat{C}}(y(c) \times X, Y), with restriction by precomposition with y(h)×idy(h) \times \mathrm{id}, one checks that Z×X→YZ \times X \to Y corresponds naturally to Z→YXZ \to Y^X; we omit this routine verification (Mac Lane and Moerdijk 1992, Chapter I).

The classifier. First, Ω\Omega is a presheaf: h∗Sh^*S is a sieve, id∗S=S\mathrm{id}^*S = S and (h∘k)∗S=k∗(h∗S)(h \circ k)^*S = k^*(h^*S). Note the key fact

f∈S  ⟺  f∗S=td(f:d→c),(∗)f \in S \iff f^*S = t_d \qquad (f : d \to c), \tag{$*$}

since f∗Sf^*S contains idd\mathrm{id}_d iff f∈Sf \in S, and a sieve containing an identity is maximal.

Let U⊆XU \subseteq X be a subpresheaf and define χ\chi as in the statement.

  • χc(x)\chi_c(x) is a sieve: if x⋅f∈U(d)x \cdot f \in U(d) and g:e→dg : e \to d, then x⋅(f∘g)=(x⋅f)⋅g∈U(e)x \cdot (f \circ g) = (x \cdot f) \cdot g \in U(e), because UU is closed under restriction.
  • χ\chi is natural: for h:c′→ch : c' \to c, h∗χc(x)={g∣x⋅(h∘g)∈U}={g∣(x⋅h)⋅g∈U}=χc′(x⋅h)h^*\chi_c(x) = \{ g \mid x \cdot (h \circ g) \in U \} = \{ g \mid (x \cdot h) \cdot g \in U \} = \chi_{c'}(x \cdot h).
  • Pullback: pullbacks are computed objectwise, and by (∗)(*) with f=idcf = \mathrm{id}_c, χc(x)=tc  ⟺  idc∈χc(x)  ⟺  x∈U(c)\chi_c(x) = t_c \iff \mathrm{id}_c \in \chi_c(x) \iff x \in U(c). So the pullback of true\mathrm{true} along χ\chi is UU.
  • Uniqueness: let ϕ:X→Ω\phi : X \to \Omega be natural with pullback of true\mathrm{true} equal to UU. For x∈X(c)x \in X(c) and f:d→cf : d \to c, f∈ϕc(x)  ⟺  (∗)f∗ϕc(x)=td  ⟺  ϕd(x⋅f)=td  ⟺  x⋅f∈U(d)  ⟺  f∈χc(x),f \in \phi_c(x) \overset{(*)}{\iff} f^*\phi_c(x) = t_d \iff \phi_d(x \cdot f) = t_d \iff x \cdot f \in U(d) \iff f \in \chi_c(x), using naturality of ϕ\phi in the second step and the pullback property in the third. So ϕ=χ\phi = \chi.

By Lemma 2 every subobject is represented by a subpresheaf, so true:1→Ω\mathrm{true} : 1 \to \Omega is a subobject classifier.

∎

Note

Yoneda also predicts Ω\Omega: if a classifier exists, Ω(c)≅C^(y(c),Ω)≅Sub(y(c))\Omega(c) \cong \widehat{\cat{C}}(y(c), \Omega) \cong \mathrm{Sub}(y(c)), and a subpresheaf of C(−,c)\cat{C}(-, c) is precisely a sieve on cc. For sheaves on a site the classifier is the sheaf of closed sieves (Mac Lane and Moerdijk 1992, Chapter III).

ProofH

The internal logic is intuitionistic

Theorem— Theorem 4 (subobjects form a Heyting algebra)

For a presheaf XX on C\cat{C}, the subpresheaves of XX form a Heyting algebra, with ∧\wedge and ∨\vee computed objectwise, 0=∅0 = \varnothing, 1=X1 = X and

(U⇒V)(c)={ x∈X(c)∣for all f:d→c,  x⋅f∈U(d)  ⟹  x⋅f∈V(d) }.(U \Rightarrow V)(c) = \{\, x \in X(c) \mid \text{for all } f : d \to c,\; x \cdot f \in U(d) \implies x \cdot f \in V(d) \,\}.

Proof

Objectwise intersections and unions of subpresheaves are subpresheaves, and the distributive lattice laws hold objectwise. U⇒VU \Rightarrow V is closed under restriction: if x∈(U⇒V)(c)x \in (U \Rightarrow V)(c) and g:e→cg : e \to c, then for f:d→ef : d \to e we have (x⋅g)⋅f=x⋅(g∘f)(x \cdot g) \cdot f = x \cdot (g \circ f), so the condition for x⋅gx \cdot g at ff is the condition for xx at g∘fg \circ f. Residuation, W≤(U⇒V)  ⟺  W∧U≤VW \le (U \Rightarrow V) \iff W \wedge U \le V:

  • (⇒\Rightarrow) if x∈W(c)∩U(c)x \in W(c) \cap U(c), apply the defining condition with f=idcf = \mathrm{id}_c to get x∈V(c)x \in V(c);
  • (⇐\Leftarrow) if x∈W(c)x \in W(c) and x⋅f∈U(d)x \cdot f \in U(d), then x⋅f∈W(d)x \cdot f \in W(d) because WW is a subpresheaf, so x⋅f∈(W∧U)(d)⊆V(d)x \cdot f \in (W \wedge U)(d) \subseteq V(d).

∎

The quantifier "for all f:d→cf : d \to c" — at every stage reachable from cc — is what separates ⇒\Rightarrow from the Boolean ¬U∪V\neg U \cup V. In particular negation is (¬U)(c)={x∣x⋅f∉U(d) for all f}(\neg U)(c) = \{ x \mid x \cdot f \notin U(d) \text{ for all } f \}: "xx is never in UU, at any stage reachable by restriction".

More generally, in every elementary topos each Sub(X)\mathrm{Sub}(X) is a Heyting algebra, the maps f∗f^* are Heyting algebra maps with adjoints ∃f⊣f∗⊣∀f\exists_f \dashv f^* \dashv \forall_f, and Ω\Omega 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 PP be a poset, viewed as a category. Then Sub(1)\mathrm{Sub}(1) in P^\widehat{P} is the Heyting algebra of down-sets of PP, with S⇒T={p∣for all q≤p, q∈S  ⟹  q∈T}S \Rightarrow T = \{ p \mid \text{for all } q \le p,\ q \in S \implies q \in T \}. In particular, for P={0<1}P = \{0 < 1\} there are exactly three truth values 0<12<10 < \tfrac12 < 1 (the down-sets ∅⊂{0}⊂{0,1}\varnothing \subset \{0\} \subset \{0, 1\}), and the topos is not Boolean: ¬12=0\neg \tfrac12 = 0, so 12∨¬12=12≠1\tfrac12 \vee \neg\tfrac12 = \tfrac12 \neq 1, although ¬¬12=1\neg\neg\tfrac12 = 1.

Proof

1(p)={∗}1(p) = \{*\}, so a subpresheaf of 11 is a set SS of objects with p∈Sp \in S, q≤p⇒q∈Sq \le p \Rightarrow q \in S: a down-set. The formula for ⇒\Rightarrow is Theorem 4. For {0<1}\{0 < 1\}: ¬{0}={p∣no q≤p lies in {0}}=∅\neg\{0\} = \{p \mid \text{no } q \le p \text{ lies in } \{0\}\} = \varnothing, since 0≤p0 \le p for both pp. Hence {0}∨¬{0}={0}\{0\} \vee \neg\{0\} = \{0\}, and ¬¬{0}=¬∅={0,1}\neg\neg\{0\} = \neg\varnothing = \{0, 1\}. If {0}\{0\} had a complement TT, disjointness would force 0∉T0 \notin T, hence T=∅T = \varnothing (a down-set), and then {0}∪T≠{0,1}\{0\} \cup T \neq \{0, 1\}.

∎

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 Sub(1)\mathrm{Sub}(1) 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 (W,≤)(W, \le) corresponds to presheaves on WopW^{\mathrm{op}}.

ExplanationH

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 S\mathcal{S} such that

  1. S\mathcal{S} is an elementary topos (finite limits, function sets, a subobject classifier);
  2. S\mathcal{S} is well-pointed: 0≇10 \not\cong 1, and arrows are determined by their effect on elements, where an element of XX is an arrow 1→X1 \to X — if f∘x=g∘xf \circ x = g \circ x for all x:1→Xx : 1 \to X then f=gf = g;
  3. S\mathcal{S} has a natural numbers object;
  4. 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 Ω≅1+1={false,true}\Omega \cong 1 + 1 = \{\mathrm{false}, \mathrm{true}\}; and by Diaconescu's theorem the choice axiom alone already implies excluded middle.

Comparison with ZFC.

ZFCETCS
Primitive notionssets and a global membership relation ∈\insets (objects) and functions (arrows), with composition
Elementssets are made of sets; "is 2∈32 \in 3?" is meaningfulan element of XX is an arrow 1→X1 \to X; elements have no internal structure
Subsetssubsets via Separationsubobjects, classified by maps X→ΩX \to \Omega
Extensionalitytwo sets with the same members are equalwell-pointedness: two functions agreeing on elements are equal
Infinityan inductive seta natural numbers object
Replacementan axiom schemenot 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 Vω+ωV_{\omega + \omega} 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.

Formal mathematicsF

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 {0<1}\{0 < 1\} is a pair of types with a restriction map; subpresheaves are pairs of sets closed under restriction (Lemma 2 justifies using them as subobjects):

PshLean 4Formally verified
/-- 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
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
SubLean 4Formally verified
/-- 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 ∈ S0
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

A sieve on 11 is encoded by two propositions — "contains id1\mathrm{id}_1" and "contains 0→10 \to 1" — 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.

OmegaLean 4Formally verified
/-- 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.2
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

The characteristic map and the pullback of true\mathrm{true} 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:

chiLean 4Formally verified
/-- 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
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
pullbackTrueLean 4Formally verified
/-- 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
Axioms used: propextformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
pullbackTrue_chiLean 4Proved here from basic factsFormally verified
/-- 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
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
chi_pullbackTrueLean 4Proved here from basic factsFormally verified
/-- 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
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
subEquivHomLean 4Formally verified
/-- **`Ω` 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_pullbackTrue
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

Theorem 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.

himpLean 4Formally verified
/-- **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
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
le_himp_iffLean 4Proved here from basic factsFormally verified
/-- 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⟩⟩
Axioms used: No axiomsformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
instHeytingAlgebraLean 4Formally verified
/-- **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_iff
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

Proposition 5: three truth values, a subobject without complement, and a truth value that is "not not true" without being true.

sub_one_trichotomyLean 4Proved here from basic factsFormally verified
/-- 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⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
sub_one_not_booleanLean 4Proved here from basic factsFormally verified
/-- **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
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor
not_not_laterLean 4Proved here from basic factsFormally verified
/-- 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 this
Axioms used: propext, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

The 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.

presheaf_category_is_toposLean 4Applies a library theoremFormally verified
/-- **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⟩⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

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:

presheaf_tensor_eq_prodLean 4Applies a library theoremFormally verified
/-- 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) :=
  rfl
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ElementaryTopoi.leanTry it in the Lean web editor

What is and is not formalised. Formalised: the Sierpiński classifier (independently), the Heyting algebra of subpresheaves on {0<1}\{0 < 1\} 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 {0<1}op\{0 < 1\}^{\mathrm{op}}; 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.

ComputationC

Computing truth values

For presheaves on a finite poset everything is finite and can be computed: the sieves Ω(p)\Omega(p), the subpresheaves of a small presheaf, all natural maps into Ω\Omega, and the Heyting operations on truth values. The experiment checks the classifier bijection of Theorem 3 for every presheaf on {0<1}\{0 < 1\} with at most four sections at stage 1 and three at stage 0, and finds which posets give Boolean truth values.

Truth values in presheaf toposesPythonExact computationExhaustive finite checkComputationally tested
"""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()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Two things to notice. The number of subpresheaves of AA — and hence, by the bijection, of natural maps A→ΩA \to \Omega — is ∏y∈A0(1+2ky)\prod_{y \in A_0} (1 + 2^{k_y}), where kyk_y is the size of the fibre of res\mathrm{res} over yy (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 DD is P∖DP \setminus D, and if a<ba < b then P∖↓aP \setminus {\downarrow} a contains bb but not aa, so it is not a down-set and ↓a{\downarrow} a has no complement. The computation is exhaustive only for the listed finite cases; the theorems above are what cover all presheaves.

Explore

Classical tautologies under three truth values

The truth-table explorer below computes classical (two-valued) truth tables — the logic of the Boolean topos Set\cat{Set}. 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).

Try:

Tautology — true in all 2 rows.

Equivalent — the two formulas agree in all 2 rows.

p¬pp ∨ ¬p¬(p ∨ ¬p)¬¬(p ∨ ¬p)p ∨ ¬pRows where they differ
TFTFTT
FTTFTT

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 0<12<10 < \tfrac12 < 1, where a⇒b=1a \Rightarrow b = 1 if a≤ba \le b and a⇒b=ba \Rightarrow b = b otherwise, and ¬a=a⇒0\neg a = a \Rightarrow 0:

pp¬p\neg pp∨¬pp \vee \neg p¬¬p\neg\neg p¬¬(p∨¬p)\neg\neg(p \vee \neg p)¬¬p⇒p\neg\neg p \Rightarrow p
001111001111
12\tfrac120012\tfrac12111112\tfrac12
110011111111

Try other formulas in the explorer and then evaluate them by hand on the three-element chain. Peirce's law ((p→q)→p)→p((p \to q) \to p) \to p is a classical tautology that fails at p=12p = \tfrac12, q=0q = 0. The weak De Morgan law ¬(p∧q)→¬p∨¬q\neg(p \wedge q) \to \neg p \vee \neg q survives on the chain, but fails for presheaves on the poset 0<2>10 < 2 > 1 (take pp, qq to be the down-sets {0}\{0\} and {1}\{1\}). In the other direction, a formula that is not a classical tautology already fails at the truth values 00 and 11 of any non-degenerate topos.

Exercises

Exercises

1. Elementary topos theory

Warm-upHuman

Consider presheaves on the chain 0<1<20 < 1 < 2 (one arrow i→ji \to j whenever i≤ji \le j). How many sieves are there on the object 22, i.e. how many elements does Ω(2)\Omega(2) have?

2. Elementary topos theory

CoreHuman

A presheaf on {0<1}\{0 < 1\} has A1={a,b,c}A_1 = \{a, b, c\}, A0={x,y}A_0 = \{x, y\} and res(a)=res(b)=x\mathrm{res}(a) = \mathrm{res}(b) = x, res(c)=y\mathrm{res}(c) = y. How many subpresheaves (S1,S0)(S_1, S_0) does it have? (Recall: S1⊆A1S_1 \subseteq A_1, S0⊆A0S_0 \subseteq A_0 and res(S1)⊆S0\mathrm{res}(S_1) \subseteq S_0.)

3. Elementary topos theory

CoreHuman

In the Sierpiński topos the truth values form the chain 0<12<10 < \tfrac12 < 1, with a⇒b=1a \Rightarrow b = 1 if a≤ba \le b and a⇒b=ba \Rightarrow b = b otherwise, and ¬a=a⇒0\neg a = a \Rightarrow 0. Which formulas take the value 11 for every truth value of pp? (Choose all that apply.)

Choose all that apply

4. Elementary topos theory

CoreHuman

Why is the category Grp\cat{Grp} of groups not an elementary topos?

Choose one

5. Elementary topos theory

StretchHuman

Let G=Z/2G = \Z/2 and consider the topos G-SetG\text{-}\cat{Set} of sets with a GG-action. Which statement is true?

Choose one

6. Elementary topos theory

CoreFormal

In 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)?

Choose one

7. Elementary topos theory

StretchHuman

In the uniqueness part of Theorem 3 we wrote, for x∈X(c)x \in X(c) and f:d→cf : d \to c: f∈ϕc(x)  ⟺  f∗ϕc(x)=td  ⟺  ϕd(x⋅f)=td  ⟺  x⋅f∈U(d)f \in \phi_c(x) \iff f^*\phi_c(x) = t_d \iff \phi_d(x \cdot f) = t_d \iff x \cdot f \in U(d). What justifies the middle equivalence f∗ϕc(x)=td  ⟺  ϕd(x⋅f)=tdf^*\phi_c(x) = t_d \iff \phi_d(x \cdot f) = t_d?

Choose one

8. Elementary topos theory

CoreHuman

Which statements about ETCS (Lawvere's Elementary Theory of the Category of Sets) are true? (Choose all that apply.)

Choose all that apply

9. Elementary topos theory

StretchComputational

The 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 ¬u\neg u — 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.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"A topos is a kind of topological space." Every space XX gives a topos Sh(X)\mathrm{Sh}(X), and for sober spaces XX can be recovered from it. But many toposes are not of this form. In G-SetG\text{-}\cat{Set} for a non-trivial group GG, the terminal object has only two subobjects, so if it were Sh(X)\mathrm{Sh}(X) the frame O(X)\mathcal{O}(X) would be {0,1}\{0, 1\} and the topos would be Sh(pt)≃Set\mathrm{Sh}(\mathrm{pt}) \simeq \cat{Set} — but GG is a non-initial GG-set with no global element, which is impossible in Set\cat{Set}. Toposes generalise spaces (and even locales), not the other way round; and elementary toposes such as FinSet\cat{FinSet} or Hyland's effective topos are not Grothendieck toposes at all.

Misconception

"The internal logic of every topos is classical, because that of Set\cat{Set} is." The internal logic is intuitionistic in general: in the Sierpiński topos, and in Sh(R)\mathrm{Sh}(\R), excluded middle fails for some truth values. Boolean toposes (such as Set\cat{Set} and G-SetG\text{-}\cat{Set}) are the special case.

Misconception

"Intuitionistic logic says excluded middle is false." It does not assume excluded middle; it does not refute it. ¬¬(p∨¬p)\neg\neg(p \vee \neg p) holds in every topos, and Set\cat{Set} is a topos where p∨¬pp \vee \neg p 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.

ViewpointsH

Viewpoints

Topology— Truth values are open sets

In Sh(X)\mathrm{Sh}(X) the truth value of a proposition about sections is the open set where it holds, and Sub(1)≅O(X)\mathrm{Sub}(1) \cong \mathcal{O}(X). Only the frame of opens matters: Sh(X)\mathrm{Sh}(X) depends on XX only through O(X)\mathcal{O}(X), so toposes see locales — "spaces without points" — rather than point-set spaces. A point of a topos E\mathcal{E} is a geometric morphism Set→E\cat{Set} \to \mathcal{E}; for a sober space, the points of Sh(X)\mathrm{Sh}(X) are exactly the points of XX. The topos Sh(X)\mathrm{Sh}(X) is Boolean exactly when O(X)\mathcal{O}(X) is a Boolean algebra, i.e. every open set is closed — for R\R, 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 XX, the étale site (étale maps U→XU \to X, covered by jointly surjective families) gives the étale topos XeˊtX_{\text{ét}}, whose sheaf cohomology with ℓ\ell-adic coefficients was the tool for the Weil conjectures, completed by Deligne (1974). Morphisms of these generalised spaces are geometric morphisms f:F→Ef : \mathcal{F} \to \mathcal{E}, adjoint pairs f∗⊣f∗f^* \dashv f_* with f∗f^* preserving finite limits; a continuous map X→YX \to Y induces one Sh(X)→Sh(Y)\mathrm{Sh}(X) \to \mathrm{Sh}(Y), and cohomology Hn(E,A)H^n(\mathcal{E}, A) 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 B\mathcal{B} such that models of the theory in any Grothendieck topos E\mathcal{E} correspond (naturally in E\mathcal{E}) to geometric morphisms E→B\mathcal{E} \to \mathcal{B}. The functor category [FinSet,Set][\cat{FinSet}, \cat{Set}] classifies objects; the functor category from finitely presented commutative rings to sets classifies commutative rings (a ring in Sh(X)\mathrm{Sh}(X) is a sheaf of rings, so ringed spaces are geometric morphisms into it); and G-SetG\text{-}\cat{Set} classifies GG-torsors, so geometric morphisms Sh(X)→G-Set\mathrm{Sh}(X) \to G\text{-}\cat{Set} are principal GG-bundles on XX for a discrete group GG — a topos-theoretic BGBG. 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 PP of conditions, the sheaves on PP 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 E ⁣f ⁣f\mathcal{E}\!f\!f (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 N\N, but internally every function N→N\N \to \N 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 & global context

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 ∞\infty-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

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.