Free algebras on sets of different cardinality – for what theories are they non-isomorphic?

It is not true for "usual theories", at least if you accept that left $R$-modules for noncommutative $R$ is a usual theory. Take $R=\mathrm{End(}V)$ for some infinite-dimensional vector space $V$, then $R \cong R^2$ as left $R$-modules. Rings for which $\forall n,m : \mathbb{N}. R^n \cong R^m \Rightarrow n=m$ holds (the case of infinite bases follows by cardinality arguments) are called IBN-rings; they are studied for example in the beginning of Lam's Lectures on modules and rings.

As for the general question, the following criterion is very useful: Assume that there is some algebra $A$ with a finite underlying set $U(A)$ which has at least $2$ elements. Then, if $F(X) \cong F(Y)$ holds for two finite sets $X,Y$, we get $$\hom(X,U(A)) \cong \hom(F(X),A) \cong \hom(F(X),A) \cong \hom(Y,U(A)).$$ Counting yields $X \cong Y$.

This was also remarked here, an almost identical question.


Jónsson and Tarski (Math. Scand. 9 (1961), 95-101, link) proved the following:

Consider a variety $\mathcal{V}$ of algebras of a certain signature. If $\mathcal{V}$ contains a finite algebra of cardinal $\ge 2$, then the free algebra $F_n(\mathcal{V})$ in $\mathcal{V}$ on $n$ elements cannot be generated by less than $n$ elements. In particular, $F_n(\mathcal{V})$ and $F_m(\mathcal{V})$ are not isomorphic for any $0\le n<m$ for $n$ finite.

This applies in many cases, for which the result itself is trivial or not: set with no law, free lattices, free magmas, free semigroups, free groups, free associative commutative unital ring, free associative ring, etc.

They also provide a counterexample without the assumption that $\mathcal{V}$ contains a finite algebra of cardinal $\ge 2$. Namely, consider the variety $\mathcal{V}_2$ with signature $(2,1,1)$, encoding a set $M$ with a bijection $M^2\to M$. Then the free algebras $F_n(\mathcal{V}_2)$ for finite $n\ge 1$ are all isomorphic. (This is called the variety of Jónsson-Tarski algebras, or pairing functions.)

(It was later checked by Higman that if we consider the variety $\mathcal{V}_k$ encoding a bijection $M^k\to M$, then $F_n(\mathcal{V}_k)$ and $F_m(\mathcal{V}_k)$, for finite $n,m\ge 1$, are isomorphic if and only if $k-1$ divides $m-n$.)

They also mention the variety of $M$-sets, where $M$ is the monoid $\langle u,v\mid uv=1\rangle$: although it has the given property, the free algebra on 1 generator in this algebra can be non-freely generated by a single element. (They also give a sufficient condition in variety ensuring that every generating $n$-tuple in the free $n$-generated algebra is free, namely residual finiteness of free algebras.)