TITLE: First isomorphism theorem for sets?
QUESTION [7 upvotes]: Let $f\colon S\to T$ be any function.  There is the obvious refinement of $f$, by replacing the codomain $T$ with the image.  Thus, every function factors into a surjection followed by an injection (and not just any injection, but an inclusion):
$$
S\twoheadrightarrow {\rm im}(f)\subseteq T.
$$
This situation can be improved even further.  Define an equivalence relation $\sim$ on $S$ by saying that $a\sim b$ when $f(a)=f(b)$.  Then $f$ factors into three maps:
$\require{AMScd}$
\begin{CD}
S @>f>> T\\
@V \pi V V @AA i A\\
S/{\sim} @>>\overline{f}> {\rm im}(f)
\end{CD}
The map $\pi$ is the canonical surjection to the partition, given by the rule $s\mapsto \overline{s}$.  The map $i$ is the stated inclusion map.  Finally, the induced map $\overline{f}$, where $\overline{s}\mapsto f(s)$, is a (well-defined) bijection.
While this diagram implicitly occurs throughout abstract algebra, the first time I recall explicitly seeing it was in a homological algebra course (in the context of abelian categories) taught by T. Y. Lam, who called $\overline{f}$ the "makeover" of $f$ (because the TV had been on when he was preparing the lecture, and he happened to catch Jenny Jones talking about makeovers).
I'm preparing to teach this diagram to my (undergraduate) abstract algebra class, as a motivation for the 1st isomorphism theorems of groups and rings.  I was wondering if the decomposition $f=i \overline{f}\pi$ has a name, in this general context of sets.  I was a little surprised to discover that the decomposition also holds for general universal algebras.  Perhaps there a name for the decomposition in that context?
By the way, unless another name is in use, I'm planning to call this result the "flock lemma".  The reason is that if we view the elements of $S$ as pigeons, and the elements of $T$ as holes, and the elements of ${\rm im}(f)$ as the inhabited holes, then $S/{\sim}$ is the collection of "flocks of pigeons" organized by which inhabited hole the flock flies to.  Feel free (in the comments) to suggest a better name (or vote for "flock lemma").

REPLY [4 votes]: I call $f=i\circ \overline{f}\circ \pi$ the canonical factorization of a function when I teach second year undergraduate discrete math (except that I write $f=\iota\circ \overline{f}\circ \nu$, using the Greek letters iota and nu for the inclusion map and the natural map). I have a handout for my students about this here.

Edit:
Let me add a comment to address the questions asked by Pace.
Is there a reason that $\nu$ is natural, but the factorization is canonical?
Natural and canonical mean different things.
Natural means: determined by Nature.
Canonical means: determined by the Canon (the law).
Something becomes Canonical because it has been ruled to be so.
The authority to call a concept Canonical might be
the person who introduced the concept, or it might be the community
who have used and developed the concept, but a canonical concept
does not have to defend its naturality.
In mathematics, I try to restrict the use of the word Natural
to situations where there is a natural transformation around,
but I refer to the universal map of a set $S$ to a quotient set $S/E$
which maps $s\in S$ to its $E$-equivalence class $s/E$ as the ``natural map''
because much of the community uses that term (e.g., in the
case where you map a group $G$ to a quotient group $G/N$
by mapping an element $g\in G$ to its coset $gN$).
Finally, to answer the question, I chose Natural for the
quotient map because it is a common convention to use this
word in this context.
I prefer Canonical over Natural
for the factorization $f=\iota\circ \overline{f}\circ \nu$
because, in this classroom setting,
I prefer to avoid any confusion
that might arise from two differing and new uses of the word Natural.
(At least, I prefer some word that is different from Natural, and Canonical
is grammatically correct.)

do your students find the term coimage palatable?
I never consider questions like this.
A term is needed, and a correct/conventional term exists.
But, to try to give you some answer, students arrive in my 2nd year discrete math course somewhat familiar with "function", "domain", and "image". They are typically not familiar with "codomain", "coimage", "naural map", or "inclusion map", so a learnng period is needed.