Let $M$ be a monoid and consider the category of $M$-acts. The morphisms of this category are mappings that preserve the action of $M$. Let $f : X \rightarrow Y$ be an epimorphism in this category, i.e. a right-cancellable morphism. I am trying to prove that actually $f$ is a surjective mapping, but i am having difficulty. Thanks for your help.
Let's assume that $f:X\to Y$ is not surjective, and let's show that $f$ is not an epimorphism.
It is straightforward to check that the equivalence relation $\sim$ defined on $Y$ by $$ y\sim y'\iff y,y'\in f(X) $$ is a congruence.
Let $z\in Y/\!\!\sim$ be the equivalence class $f(X)$, and let $c:Y\to Y/\!\!\sim$ be the constant map equal to the equivalence class $f(X)$.
Then we have $p\circ f=c\circ f$ but $p\neq c$.