How can one define, in terms of equations, independence of elements in an algebraic structure defined by identities?

I have been thinking about free algebraic structures. I know the definition by a universal property. But there is a common interpretation that a free structure is one generated by a set of "independent" elements, or elements that are in "no relation" to one another. I have not found a rigorous treatment of this interpretation in the books I have read.

What is a relation between elements of a structure? I understand it's a kind of equation that those elements satisfy, the kind being specific to the kind of structure. $\mathbb Z$ is the free group generated by the one-element set, $\{x_1\}=\{1\}$. There is an equation this set satisfies:

$$x_1=x_1.$$

So it's not enough for a set of generators to satisfy any equation in order not to be independent. I know from group theory that a set $X$ of elements of a group $G$ is a basis of a free subgroup of $G$ iff there is no finite product of elements of $X\cup X^{-1},$ without sequences of the form $x_ix_i^{-1}$ and $x_i^{-1}x_i$ in it, such that this product is equal to $1$. I hope this is true at least, as this is not a theorem I have read. But I think this is correct.

There's a lot of equations this definition doesn't take into account. Brackets are not considered, no terms of the form $((x_i^{-1})^{-1})^{-1}$ and the like are allowed. And the right-hand side has to be $1$.

For semigroups, this changes. I have not seen a definition of a "free basis" for semigroups given in these terms but I think it should say what follows. A subset $X$ of a semigroup $S$ is a set of free generators iff the equality of two finite products of elements of $X$ implies the equality of the words over $X$ used to write those products.

So in this case, the right-hand side doesn't have to be $1$ (which doesn't change for monoids, even though $1$ exists in them). But brackets are still not considered.

For magmas, I think the definition should be this.

A subset $X$ of a magma $M$ is a free basis iff no equation is satisfied by its elements with the exception of equating identical (correct) strings of variables and brackets.

With more complex structures like modules, it gets (in a sense) even more complicated (that is more equations are not considered). The definition in this case is that of linear independence, which is the only definition of independence I've encountered.

A great many of equations equations are not considered in this deifnition. The right-hand side has to be $0$; there must at least one coefficient equal to $0$; the same element of the basis may appear only once; the coefficients are just elements of the ring, not sums, products additive inverses of elements of the ring; brackets are not considered.

I would like to know if there is a general definition that would allow me to find out which equations I should consider when I want to define an independent set of elements of some specific type of structure not mentioned above. (I think it's important to reduce the scope of this question to structures whose axioms are identities, unlike fields for example.)

-
One reason you might run into some circular problems: the equations that specific commutative rings satisfy are polynomials, elements of free commutative rings; the equations that groups satisfy are reduced words, elements of free groups. You might like "varieties". They start with some idea of "absolutely free" that is either explicitly constructed or a universal property, but then all the relatively free definitions are clearly non-circular. "Free abelian group" is a group whose set of identities is the normal subgroup generated by xy=yx. – Jack Schmidt Mar 1 '12 at 16:42
Consider looking at George Bergman's An invitation to General Algebra and Universal Constructions. He presents three different constructions of free groups (three different ways of looking at them), and later discusses the "free objects". – Arturo Magidin Mar 1 '12 at 17:05
I second Arturo's recommendation of Bergman's superb textbook. It is probably the best place to learn about the various ways of defining and constructing free algebras. It contains the answers to your questions (and much more). – Bill Dubuque Mar 1 '12 at 17:16
@ArturoMagidin Thank you! – user23211 Mar 3 '12 at 16:21

Supposing you stay within the realm of structures $S$ for which a "free $S$ on a set $X$" is defined (by a universal property), there is a precise sense one can give to a set $Y$ of elements of any structure $S_0$ to be independent, but you might find it a bit circular and therefore disappointing. The sense is as follows: let $X$ be a copy of $Y$ (detached from the structure $S_0$ in which $Y$ was contained), let $F$ be the free $S$ on $X$, and consider the unique morphism $f:F\to S_0$ that sends each element of $X$ to the corresponding (because $X$ is a copy of $Y$) element of $Y$ (which exists by the universal property). Then the set $Y$ is by definition independent in $S_0$ if $f$ is injective. So for the free $S$ on any $X$ itself, $X$ is trivially independent.
Every expression in the language of structures $S$ involving (apart from constants of the language) only elements of $X$ desginates a unique element in the free structure $F$, and by replacing the elements of $X$ by their counterparts in $Y$ the expression also designates an element in $S_0$. The injectivity requirement now says that two expressions designating the same element of $S_0$ (an equation between these expressions) necessarily already designate the same element in $F$ (such equations are those you call "not considered"; these are precisely the equations that always hold in structures $S$).
You may check that for instance in a free group an expression such as $(x^{-1})^{-1}$ just designates $x$, so the equation $x=(x^{-1})^{-1}$ is one that is not considered, and in the end no expression that contains the inverse of an inverse needs to be considered, since one gets an equivalent expression (in any group, including in a free group) by dropping both inverses. Similarly words that contain a letter multiplied directly by its inverse can be simplified, as can expressions with redundant parentheses. So all elements of the free group on $X$ can be described by strings over $X\cup X^{-1}$ (no parentheses, no nested inverses) without any occurrence of a letter next to its inverse (on either side). Also equations of the form $E_1=E_2$ can be replaced by $E_1(E_2)^{-1}=e$ (which has as consequence that to test a morphism for being injective it suffices to consider its kernel: the inverse image of $e$); this explains why you need only consider equations with one member the identity, at least for groups. If you look closely, you will find that all the peculiarities of equations that need to be considered for different structures can be explained by the details of their "free structures", and the properties of their morphisms.
My answer gives a way to determine what "independent" should mean whenever a "free $S$" is meaningful. You can keep it a secret that you looked into the construction details of a free $S$ to find out; in concrete cases the resulting characterisation of "independent" is stand-alone. However you cannot expect something that is uniform over all kinds of structures, since as you remarked the details do vary. Another option is using logic: a set is independent if the only relations that hold are those implied by the axioms of the structure $S$. – Marc van Leeuwen Mar 1 '12 at 18:00