I have been going through the proof of Theorem 9.4 in "Sets for Mathematics" by Lawvere and Rosebrugh, which proves that $1+\mathbb{N} \cong \mathbb{N}$, but I am a little confused over how to prove from that, that the successor map $\sigma:\mathbb{N} \rightarrow \mathbb{N}$ is not surjective, which is the exercise 9.15. I know from corollary 9.6 in the book that $\sigma: \mathbb{N} \to \mathbb{N}$ is injective since the predecessor map $p$ is a retraction for $\sigma$.
The definition of infinite is that of Dedekind, i.e. a set $X$ is infinite if there exists an $s:X \to X$ which is injective but not surjective.
Now, I though about using proof by contradiction, so that I suppose that $\sigma$ surjective, and get a contradiction from the fact that $\sigma$ surjective implies that $\sigma(n)=0$ for some $n$, but the proof of theorem 9.4 doesn't immediately suggest any relevant angle of attack on the problem.
In the proof of 9.4, one proves that $1+\mathbb{N} \cong \mathbb{N}$ by constructing an inverse $g:\mathbb{N} \to 1 + \mathbb{N}$ to the unique $f:1+\mathbb{N} \to \mathbb{N}$ via recursion.
$g$ can be shown to satisfy:
$$ g(0) = i_\ast$$ $$ g(n+1)=i_\mathbb{N}(n)$$
Where $i_\ast:1 \to 1+\mathbb{N}$ and $i_\mathbb{N}:\mathbb{N} \to 1+\mathbb{N}$ are the injections into $1 + \mathbb{N}$.
$1$ denotes the terminal object in the category of sets, and $\mathbb{N}$ is a natural numbers object in the category of sets. All morphisms in the category are supposed to be total functions.
Many thanks in advance!
We demonstrate that $s$ is not an epimorphism, by constructing $u_0,u_1: \mathbb N \to \mathbb N$ such that $u_0 \circ s = u_1 \circ s$ while $u_0 \neq u_1$; in fact, this works in any category where $s \neq \mathrm{id}_{\mathbb N}$, not just $\mathsf{Set}$.
Writing $!: \mathbb N \to 1$ for the terminal morphism, we let $u_0$ be the universal arrow in the diagram $$ \require{AMScd} \begin{CD} 1 @>{0}>> \mathbb N @>{s}>>\mathbb N\\ @VV{\mathrm{id}_1}V @VV{u_0}V @VV{u_0}V\\ 1 @>{0}>> \mathbb N @>{0 \circ {!}}>> \mathbb N; \end{CD} $$ and we let $u_1$ be the universal arrow for $$ \require{AMScd} \begin{CD} 1 @>{0}>> \mathbb N @>{s}>>\mathbb N\\ @VV{\mathrm{id}_1}V @VV{u_1}V @VV{u_1}V\\ 1 @>{s \circ 0}>> \mathbb N @>{0 \circ {!}}>> \mathbb N. \end{CD} $$ Now $u_0 \circ 0 = 0 \neq s \circ 0 = u_1 \circ 0$, because if $0 = s \circ 0$, then the universal arrow for $$ \require{AMScd} \begin{CD} 1 @>{s \circ 0 = 0}>> \mathbb N @>{s}>> \mathbb N \end{CD} $$ equals both $s$ and $\mathrm{id}_{\mathbb N}$. In particular, $u_0 \neq u_1$. However, $$ u_0 \circ s = 0 \circ {!} \circ u_0 = 0 \circ {!} \circ u_1 = u_1 \circ s. $$ Basically, this answer just uses recursion to give the two simplest distinct functions $\mathbb N \to \mathbb N$ which agree on all values but 0.