I am sorry if my question is too simple.
Is every semigroup associated to a group? If no, what conditions should be satisfied for a semigroup to have an associated group? If yes, how can I find the group?
I thought of the universal property. Let $X$ be a semigroup, define $G$ to be the group with a morphism of semigroups $\tau: X \rightarrow G$, such that if $H$ is any group having similar morphism $\phi: X \rightarrow H$, there is a group homomorphism $\psi: G \rightarrow H$, such that $\phi = \psi \circ \tau$.
Uniqueness is obtained from the universal property. But existence needs construction. When there is no element $x$ in $X$ such that for any $a \in X$, $xa = ax = a$, i.e., $X$ doesn't contain an identity element, I define $G = \{ 1 \} \cup \{ x_1^{k_1} \cdots x_n^{k_n} | x_i \in X, k_i \in \{ \pm 1 \}, i = 1, \cdots, n; k_jk_{j+1} = -1, 1 \leq j <n \}$ with equivalence relations: $x^{k}x^{-k} \equiv 1$, $x_1^{k_1} \cdots x_{i-1}^{k_{i-1}}x_i^kx_i^{-k}x_{i+2}^{k_{i+2}} \cdots x_n^{k_n} \equiv x_1^{k_1} \cdots x_{i-1}^{k_{i-1}}x_{i+2}^{k_{i+2}} \cdots x_n^{k_n}$ and group operations
Multiplication: $\begin{cases} 1 \cdot x_1^{k_1} \cdots x_n^{k_n} = x_1^{k_1} \cdots x_n^{k_n} \cdot 1 =x_1^{k_1} \cdots x_n^{k_n}, \\ x_1^{k_1} \cdots x_n^{k_n} \cdot y_1^{l_1} \cdots y_m^{l_m}= \begin{cases} x_1^{k_1} \cdots x_n^{k_n}y_1^{l_1} \cdots y_m^{l_m} & \text{ if } k_nl_1=-1, \\ x_1^{k_1} \cdots (x_ny_1)^{l_1} \cdots y_m^{l_m}& \text{ if } k_nl_1=1; \end{cases} \end{cases}$
Inverse: $1^{-1} =1$, $(x_1^{k_1} \cdots x_n^{k_n})^{-1} = x_n^{-k_n} \cdots x_1^{-k_1}$.
Then clearly, the morphism $\tau: X \rightarrow G$ can be defined to send every $x \in X$ to $x \in G$.
Beside possible leaks, this construction is not precise, and doesn't work in case when $G$ already has an identity, or even is a group.
So, when are semigroups associated with a group, and how can I construct a group from a semigroup?
Thanks in advance.