Second isomorphism theorem for semigroups Let $S$ be a semigroup. If $S$ has a zero element, define $S^0 = S$. Otherwise define $S^0$ as $S$ with a zero element adjoined. A subset $I$ of $S$ is an ideal if it is closed under left and right multiplication by every $s \in S$. The Rees quotient $S/I$ is the quotient semigroup $S/\sim_I$ where $a \sim_I b \iff a = b \lor (a \in I \land b \in I)$.
Here is an exercise in my book:

Let $I$ be an ideal and $H$ be a subsemigroup of a semigroup $S$. Then $H \cup I$ is a subsemigroup of $S$, $I$ is an ideal of $H \cup I$, $I \cap H$ is an ideal of $H$, and $H \cup I / I = H / H \cap I$

I think this is incorrect. If $I$ is nonempty and $H \cap I = \varnothing$, $H \cup I / I$ is not $H / H \cap I$ but with a zero element adjoined. So the correct statement should be $H \cup I / I = (H / H \cap I)^0$. Is this right?
Edit: This holds only if $I$ is nonempty. If $I$ is empty this also doesn't hold. Then what would be the general correct statement?
 A: First observe that $I$ is the zero element of $S/I$ is $I\ne \emptyset$.
Also, if $S$ has a zero and $I\ne\emptyset$, then necessarily $0\in I$.

Let $I$ be an ideal and $H$ be a subsemigroup of a semigroup $S$. Then

*

*$H\cup I$ is a subsemigroup of $S$,

*$I$ is an ideal of $H\cup I$,

*$I\cap H$ is an ideal of $H$, and

*$\bigl((H\cup I)/I\bigr)^0$ is canonically isomorphic to $\bigl(H/(H\cap I)\bigr)^0$

The first three items are trivial. For the last item consider the map
$f\colon H\cup I\to \bigl(H/(H\cap I)\bigr)^0$ given by
$$f(x)=\begin{cases}0&x\in I\\ [x]_{H\cap I}&x\in H\setminus I\end{cases} $$
This is quite clearly a homomorphism and factors over the $\sim_I$ equivalence relation. Hence it defines a homomorphism $H(H\cup I)/I\to  \bigl(H/(H\cap I)\bigr)^0$, which extends in a unique way to a homomoprhism $\tilde f\colon \bigl((H\cup I)/I\bigr)^0\to \bigl(H/(H\cap I)\bigr)^0$.
Similarly, we can start with $g\colon H\to \bigl((H\cup I)/I\bigr)^0$, given by
$$ g(x)=\begin{cases}0&x\in H\cap I\\ [x]_I&x\in H\setminus I\end{cases}$$
to find $\tilde g\colon  \bigl(H/(H\cap I)\bigr)^0\to \bigl((H\cup I)/I\bigr)^0$. One quickly verifies that $\tilde f\circ \tilde g$ and $\tilde g\circ \tilde f$ are the respective identity homomoprhisms. $\square$.
As you noted, in general we cannot simply drop the $(-)^0$ operator.
A: The exercise should be slightly modified as follows, avoiding at the same time introducing $S^0$:

Let $I$ be an ideal and $H$ be a subsemigroup of a semigroup $S$. Then $H \cup I$ is a subsemigroup of $S$, $I$ is an ideal of $H \cup I$, $I \cap H$ is an ideal of $H$, and if $I \cap H$ is nonempty, then $(H \cup I) / I = H / (H \cap I)$.

The proof is immediate, since both semigroups have support
$$
\bigl((H \cup I) - I\bigr)\cup \{0\} = (H - I) \cup \{0\} = \bigl(H - (H \cap I)\bigr)\cup \{0\}
$$
with product $*$ defined, for all $x,y \in (H - I) \cup \{0\}$ by
$$
x * y = \begin{cases}
xy&\text{if $x, y, xy \in H - I$}\\
0&\text{otherwise}
\end{cases}
$$
