Let $S$ be a semigroup. If every finitely generated $T\lt S$ is embeddable in a group then $S$ is embeddable in a group. 
Let $S$ be a semigroup. If any finitely generated $T\lt S$ is embeddable in some group $G_T$ then also $S$ is embeddable in some group $G$.

I am trying to prove this statement, which is an exercise of a Model Theory course I am attending. Actually is one of the first exercise of this kind I try to solve. 
Intuitively it seems to me an application of the compactness theorem. My approach would be something like:


*

*Write, in the language of groups, an appropriate theory $\mathbb{T}$ of semigroups embedddable in some group.

*Show that any finite subtheory of $\mathbb{T}$ has a model if and only if any finetely generated semigroup embeds in some group $G_T$
Anyway I cannot quite formalize it and suspect to be heading in the wrong direction.
Moreover, does this kind of results hold in general for first order algebraic structures? 
 A: Hint. Expand the language of groups by adding a constant for each element of $S$. Let $\Sigma$ be the theory consisting of the group laws plus the diagram of $S$. A model for $\Sigma$ will be a group in which $S$ is embedded. Use the assumption about finitely generated subsemigroups of $S$ to show that every finite subset of $\Sigma$ is satisfiable. It follows by compactness that $\Sigma$ is satisfiable.
A: We use the product semigroup $S\times G$ with projections $\pi_1\colon S\times G\to S$, $\pi_2\colon S\times G\to G$. An embedding of a subsemigrup of $S$ to $G$ is anything that satisfies the following sentences (details left to the reader):


*

*is a relation 
$$\forall x\colon x\in S\times G$$

*is left and right unique
$$\forall x, \forall y\colon \pi_1(x)=\pi_1(y)\leftrightarrow \pi_2(x)=\pi_2(y)$$

*is closed under  multiplication
$$\forall x,\forall y,\exists z\colon xy=z.$$
In addition to these, we have (presumably infinitely many, namely one for ech $s\in S$) sentences of the form
$$ \tag{$\star$}\exists x\colon \pi_1(x)=s.$$
We are given that there is a model for every finite subset of $(\star)$ together with the first three ...
