6 deleted 1933 characters in body; added 71 characters in body

A possible solution. I think

Edit I found a solution but it is not very explicit, so a more explicit description is welcome. Let $w$ be a word. Let $S_0=\{w\}$ . We shall construct sets of words $S_n$, $n=0,1,2,...$ by induction. Suppose $S$ is already constructed. If $S_n$ contains two words $u,v$ of the form $pu', v'p$, then we replace these pair of words ($u$ and $v$ may be the same) by the three words $p, u', v'$. Also if we have a pair of words $p, pu$ or $p,up$, then we replace it by $p,u$. This way we get a new set $S_{n+1}$. If we cannot do any changes, the process terminates. Clearly the process eventually terminates because the lengths of the words can only get smaller.

Claim. Inverting $w$ gives us a group iff the last set $S_n$ contains all the generators.

Proof. It is clear that if $S_n$ contains all generators, then the result is a group. Assume that a generator $x_1$ is not in the set. Then $x_1$ is either not the first letter of any word in $S_n$ or not the last letter of any of these words (otherwise $S_n$ is not the terminal set of words). Suppose the former holds (WLOG). Let $S_n=\{u_1,...,u_k\}$. Then adding inverse to $w$ implies adding inverses to $u_1,...,u_k$. Hence the resulting monoid is a quotient of the following monoid:$$G_t=\langle x_1,...,x_n, t_1,...,t_k\mid u_it_i=1, t_iu_i=1, i=1,...,k\rangle.$$ Moreover it is clear that $G_t$ is in fact islomorphic to the monoid obtained by adding the inverse to $w$. Now the fact that $S_n$ is terminal set means that the presentation of $G_t$ is complete" (i.e. confluent and terminating because there are no overlaps, see any book on string rewriting). Now suppose that $x_1$ has an inverse. Then $x_1v=1$ in $G_t$ for some $v$. But this relation cannot be deduced by applying the defining relations of $G_t$ moved my answer from left here to right since $x_1$ is not the first letter of any word in $S_n$, a contradictionanswer box below.

5 edited tags
4 added 1938 characters in body; deleted 1 characters in body

A possible solution. I think I found a solution but it is not very explicit, so a more explicit description is welcome. Let $w$ be a word. Let $S_0=\{w\}$ . We shall construct sets of words $S_n$, $n=0,1,2,...$ by induction. Suppose $S$ is already constructed. If $S_n$ contains two words $u,v$ of the form $pu', v'p$, then we replace these pair of words ($u$ and $v$ may be the same) by the three words $p, u', v'$. Also if we have a pair of words $p, pu$ or $p,up$, then we replace it by $p,u$. This way we get a new set $S_{n+1}$. If we cannot do any changes, the process terminates. Clearly the process eventually terminates because the lengths of the words can only get smaller.

Claim. Inverting $w$ gives us a group iff the last set $S_n$ contains all the generators.

Proof. It is clear that if $S_n$ contains all generators, then the result is a group. Assume that a generator $x_1$ is not in the set. Then $x_1$ is either not the first letter of any word in $S_n$ or not the last letter of any of these words (otherwise $S_n$ is not the terminal set of words). Suppose the former holds (WLOG). Let $S_n=\{u_1,...,u_k\}$. Then adding inverse to $w$ implies adding inverses to $u_1,...,u_k$. Hence the resulting monoid is a quotient of the following monoid:$$G_t=\langle x_1,...,x_n, t_1,...,t_k\mid u_it_i=1, t_iu_i=1, i=1,...,k\rangle.$$ Moreover it is clear that $G_t$ is in fact islomorphic to the monoid obtained by adding the inverse to $w$. Now the fact that $S_n$ is terminal set means that the presentation of $G_t$ is complete" (i.e. confluent and terminating because there are no overlaps, see any book on string rewriting). Now suppose that $x_1$ has an inverse. Then $x_1v=1$ in $G_t$ for some $v$. But this relation cannot be deduced by applying the defining relations of $G_t$ from left to right since $x_1$ is not the first letter of any word in $S_n$, a contradiction.

3 added 93 characters in body; edited body
2 added 2 characters in body
1