Question: Is the following a correct formal construction of the set of "strings"/"words" used in the construction of free semigroups? (And free monoids and free groups?)
Define for all $n \ge 1$ the set $[n]:= \{1, 2, \dots, n\}$ and $[0]:= \emptyset$. In what follows, use exponential notation for function spaces, i.e. the space of all functions $X \to Y$ is denoted $Y^X$.
Claim: The underlying set (i.e. I am not yet addressing the definition of multiplication) of the free semigroup generated by the elements of an arbitrary set $X$ can be taken to be:
$$\bigcup_{n \ge 1} X^{[n]} $$
(Should this be a disjoint union instead of a union? There is no set of all sets, and I haven't explicitly identified a common superset of all of the $X^{[n]}$.)
Correspondingly I also claim that the underlying set of the free monoid generated by the elements of an arbitrary set $X$ can be taken to be:
$$\bigcup_{n \ge 0} X^{[n]} $$
There is exactly one function $\emptyset \to X$. My implicit claim is that we can sensibly identify the empty function with the empty string.
Multiplication would of course then just be "concatenation", but precisely defining that is annoying especially when the underlying idea is so much simpler than all of the constructions I can think of, so I will "leave it as an exercise for the reader".
Mostly I'm just interested in whether or not this is a standard construction of the set of all strings, or if there are better, more sensible ways to do it/think about it.
The underlying sets for free monoids and as a special case free abelian groups are given precise constructions in the sources I've read, but the same was not true for free semigroups/free monoids/free groups. (For free groups one could replace $X$ with $X \times X$ or something like that.)
What you have done is fine, and is a very sensible way of providing a set-theoretic construction of the set of all finite strings of elements of a set (or non-empty finite strings, in the case of free semirings).
The choice of whether to use union or disjoint union doesn't particularly matter: the sets $X^{[n]}$ are pairwise disjoint anyway, so the union and disjoint union are in bijective correspondence.
For free groups, the matter is slightly complicated by the fact that you have to account for inverses of elements. In this case, the underlying set is $$\bigcup_{n \ge 0} (X \cup X^{-1})^{[n]}$$ where $X^{-1} = \{ x^{-1} \mid x \in X \}$ is a set of 'formal inverses' of elements of $X$. Or, if you wanted to be super nitpicky, you could take $([2] \times X)^{[n]}$ rather than $(X \cup X^{-1})^{[n]}$, and interpret $(1,x)$ as $x$ and $(2,x)$ as $x^{-1}$. The group operation is then defined by concatenation followed by reduction, i.e. in any given string, keep deleting any instances of $xx^{-1}$ or $x^{-1}x$ until there are no such instances.