Idea

A natural numbers object (NNO) in a topos is an object that behaves in that topos like the set ℕ\mathbb{N} of natural numbers does in Set; thus it provides a formulation of the “axiom of infinity” in structural set theory (such as ETCS). The definition is due to William Lawvere (1963).

The proof is straightforward. It follows for example that the left adjoint part f*f^\ast of a geometric morphism f*⊣f*:E→Ff^\ast \dashv f_\ast: E \to F between toposes with natural numbers objects preserves the natural numbers object, and also that a Grothendieck quasitoposQQ presented by a site(C,J)(C, J) has a natural numbers object, since the reflection functorL:SetCop→QL: Set^{C^{op}} \to Q preserves finite products and the terminal object in particular.

In a general category with finite products

Note that this definition actually makes sense in any category EE having finite products. However, if EE is not cartesian closed, then it is better to explicitly assume a stronger version of this definition “with parameters” (which follows automatically when EE is cartesian closed, such as when EE is a topos). What this amounts to is demanding that (ℕ,z,s)(\mathbb{N}, z, s) not only be a natural numbers object (in the above, unparametrized sense) in EE, but that also, for each object AA, this is preserved by the cofree coalgebra functor into the Kleisli category of the comonadX↦A×XX \mapsto A \times X (which may be thought of as the category of maps parametrized by AA). (Put another way, the finite product structure of EE gives rise to a canonical self-indexing, and we are demanding the existence of an (unparametrized) NNO within this indexed category, rather than just within the base EE).

To be explicit:

Definition

In a category with finite products, a parametrized natural numbers object is an object NN together with maps z:1→Nz: 1 \to N, s:N→Ns: N \to N such that given any objects AA, XX and maps f:A→Xf: A \to X, g:X→Xg: X \to X, there is a unique map ϕf,g:A×N→X\phi_{f, g}: A \times N \to X making the following diagram commute:

The functions which are constructable out of the structure of a category with finite products and such a “parametrized NNO” are precisely the primitive recursive ones. Specifically, the unique structure-preserving functor from the free such category FF into Set yields a bijection between HomF(1,ℕ)Hom_F(1, \mathbb{N}) and the actual natural numbers, as well as surjections from HomF(ℕm,ℕ)Hom_F(\mathbb{N}^m, \mathbb{N}) onto the primitive recursive functions of arity mm for each finite mm. With cartesian closure, however, this identification no longer holds, since non-primitive recursive functions (such as the Ackermann function) become definable as well.

For a category CC with binary coproducts and 1, the natural numbers object can be equivalently described as an initial algebra structure (0,s):1+ℕ→ℕ(0, s): 1 + \mathbb{N} \to \mathbb{N} for the endofunctor F(c)=1+cF(c) = 1 + c defined on CC. Then condition 1 is a special case of Lambek's theorem, that the algebra structure map of an initial algebra is an isomorphism.

As for condition 2, given f:ℕ→Xf: \mathbb{N} \to X such that f=f∘sf = f \circ s, the claim is that ff factors as

ℕ→!1→xX\mathbb{N} \overset{!}{\to} 1 \overset{x}{\to} X

for some unique xx, in fact for x=f(0)x = f(0). Uniqueness is clear since !:ℕ→1!: \mathbb{N} \to 1, being a retraction for 0:1→ℕ0: 1 \to \mathbb{N}, is epic. On the other hand, substituting either ff or f(0)∘!f(0) \circ ! for gg in the diagram

Here we just give an outline, referring to (Johnstone), section D.5.1, for full details. Let NN be an object satisfying the two colimit conditions of Freyd. First one shows (see the lemma 1 below) that NN has no nontrivial FF-subalgebras. Next, let AA be any FF-algebra, and let i:B→N×Ai: B \to N \times A be the intersection of all FF-subalgebras of N×AN \times A. One shows that π1∘i:B→N\pi_1 \circ i: B \to N is an (FF-algebra) isomorphism. Thus we have an FF-algebra map f:N→Af: N \to A. If g:N→Ag: N \to A is any FF-algebra map, then the equalizer of ff and gg is an FF-subalgebra of NN, and therefore NN itself, which means f=gf = g.

Lemma

Let FF be the endofunctor F(X)=1+XF(X) = 1+X. If NN satisfies Freyd’s colimit conditions, then any FF-subalgebra of NN is the entirety of NN.

Proof

Following (Johnstone), we may as well show that the smallest FF-subalgebra N′N' of NN (the internal intersection of all FF-subalgebras) is all of NN. Let S↪N×NS \hookrightarrow N \times N be the union of the relation R=⟨1,s⟩:N→N×NR = \langle 1, s \rangle: N \to N \times N and its opposite, so that SS is a symmetric relation. Working in the Mitchell-Bénabou language, one may check directly that the following formula is satisfied:

Observe that TT is an equivalence relation that contains SS and therefore RR. It therefore contains the kernel pair of the coequalizer of 11 and ss; since this coequalizer is by assumption N→1N \to 1, the kernel pair is all of N×NN \times N. Also observe that since N′N' is SS-closed by definition, it is TT-closed as well, and we now conclude

Remark

A slightly alternative proof of sufficiency uses the theory of well-founded coalgebras, as given here. If NN is a fixpoint of the functor F(X)=1+XF(X) = 1+X, regarded as an FF-coalgebra, then the internal union of well-founded subcoalgebras of NN is a natural numbers object ℕ\mathbb{N}. Then the subobject ℕ↪N\mathbb{N} \hookrightarrow N can also be regarded as a subalgebra; by the lemma, it is all of NN. Thus NN is a natural numbers object.

Free constructions in a topos

In topos theory the existence of a natural numbers object (NNO) has a couple of far-reaching consequences.

Firstly, it is a theorem is due to C. J. Mikkelsen that the existence of a NNO in a topos 𝒮\mathcal{S} is equivalent to the existence of free monoids in 𝒮\mathcal{S}:

Proposition

Let 𝒮\mathcal{S} be a topos and mon(𝒮)\mathbf{mon}(\mathcal{S}) its category of internal monoids. Then 𝒮\mathcal{S} has a NNO precisely if the forgetful functor U:mon(𝒮)→𝒮U:\mathbf{mon}(\mathcal{S})\to \mathcal{S} has a left adjoint.

A consequence of this, discussed in sec. B4.2 of (Johnstone 2002,I p.431), is that classifying toposes for geometric theories over 𝒮\mathcal{S} exist precisely if 𝒮\mathcal{S} has a NNO.

So from a different perspective, in a topos the existence of free objects over various gadgets like e.g. algebraic theories or geometric theories (often) hinge on the existence of free monoids, the intuition being that the free monoids permit to construct a free model syntactically by providing for the (syntactic) building blocks needed for this process.

Notice that algebraic theories can nevertheless have free algebras even if the ambient topos lacks a NNO. This may happen for algebraic theories that have the property that the free algebra on a finite set of generators has a finite carrier e.g. in the topos FinSetFinSet of finite sets free graphic monoids exist.

where the inverse image form the product with XX. Hence for ℕ∈ℰ\mathbb{N} \in \mathcal{E} a natural numbers object, the projection (X×ℕ→X)(X \times \mathbb{N} \to X) is a natural numbers object in ℰ/X\mathcal{E}_{/X}.