TITLE: Exact sequence of monoids
QUESTION [15 upvotes]: What is the right definition of an exact sequence of monoid homomorphisms?  
I can't seem to find a consistent in my searches; indeed Balmer (Remark 2.6,
  http://www.math.ucla.edu/~balmer/Pubfile/Prod.pdf )
calls it a "slippery notion".  
Among other things, I'll know that it's a good definition if I can take an exact sequence of groups and forget inverses and obtain an exact sequence of monoids.  
One possible answer is just to take the definition for groups: a sequence 
$$A \xrightarrow{f} B \xrightarrow{g} C $$
of monoid homomorphisms is exact if $\mathrm{ker}\ g = \mathrm{img}\ f$, i.e.,
$$ \{ y \in B : g(y) = 1 \} = \{ f(x) : x \in A \}. $$
But, according to Bergman (3.10.6--7, http://math.berkeley.edu/~gbergman/245/Ch.3.pdf),
this definition of kernel does not determine the image.  Instead, we look at the \emph{kernel congruence}
$$ K_g = \{(y,z) \in B \times B : g(y)=g(z)\}. $$
The set $K_f$ defines a \emph{congruence} on $A$, an equivalence relation compatible with the operation on $A$, i.e., if $(y,z),(y',z') \in K_g$ then $(yy',zz') \in K_g$.  
So then how should we define the image $I_f$ so that our sequence is exact if and only if $I_f=K_g$.  One proposal is given by Arturo Magidin (https://math.stackexchange.com/questions/18387/is-there-an-analogue-of-short-exact-sequences-for-semigroups): he defines
$$ I_f = (f(A) \times f(A)) \cup \Delta(B) $$
where $\Delta(B)=\{(b,b) : b \in B\}$.  
This notion, though probably useful in some ways, has a grave defect.  Let 
$$ A \xrightarrow{f} B \xrightarrow{g} C, $$
be an exact sequence of groups, so
$$ \mathrm{ker} g = \{y \in B : g(y) = 1\} = \mathrm{img} f = \{f(x) : x \in A\}. $$
I would like to verify that the sequence is exact as a sequence of monoids, so $I_f=K_g$.  We have $(y,z) \in K_g$ if and only if $g(yz^{-1}) = 1$ since g is a group homomorphism, if and only if $yz^{-1} \in K = \mathrm{ker} g$ if and only if $y = kz$ for some $k \in K$.  Thus
$$ K_g = \{(kz,z) \in B \times B : k \in K, z \in B \}. $$
On the other hand, suppose g is not injective and that f is not surjective (not an
atypical situation).  Then there exists $z \in B$ such that $z \not\in f(A)$
and there exists $k \in K$ such that $k \neq 1$.  Then $(kz,z) \in K_g$ by
definition, but $(kz,z) \not\in I_f$: it does not belong to $f(A) \times f(A)$
since $z \not \in f(A)$ and does not belong to $\Delta(B)$ since $kz \neq z$.  So
$K_g \not\subseteq I_f$.  
I can see why one must add the diagonal to $f(A) \times f(A)$, since one
wants a reflexive relation on B.  It follows that $I_f$ is an
equivalence relation.  I would think that one should go farther and
take the image to be the congruence closure of $I_f$, i.e., the submonoid
$\overline{I}_f$ of $B \times B$ generated by $f(A) \times f(A)$ and $\Delta(B)$.  Then it is clear that $(kz,z) = (k,1)(z,z)$ in $\overline{I}_f$, and so
$K_g \subseteq \overline{I}_f$.  Conversely, it is clear that $\overline{I}_f$ is
a subset of $K_g$, so then I'm happy again.
But this definition has a different problem: an exact sequence
$$ A \xrightarrow{f} B \to 1$$
of monoids is exact if $f$ is surjective but not conversely: the inclusion map
$$ \mathbb{N} \xrightarrow{f} \mathbb{Z} $$
of the natural numbers in the integers has $\overline{I}_f = \mathbb{Z} \times \mathbb{Z}$ but is not surjective.  Arturo Magidin pointed out to me in an e-mail that this map $f$ is an epimorphism in the category of monoids; maybe I'll have to accept that.
Can anyone shed some light on this matter?  I'd already be pretty happy with a reference.

REPLY [2 votes]: For the special case of commutative monoids, or more generally semimodules over a semiring, my related preprints on arXiv might be helpful (see below). For arbitrary monoids, the general definition is similar, however it is difficult to apply since the notion of the cokernel of a morphism of monoids is really "slippery":
http://arxiv.org/abs/1111.0330
http://arxiv.org/abs/1210.4566