Lawvere theories with two generic objects
What is the simplest example of a category with finite products and two objects $X,Y$ such that
- $X$ and $Y$ are not isomorphic,
- $X$ is isomorphic to $Y^n$ for some $n \in \mathbb{N}$,
- $Y$ is isomorphic to $X^m$ for some $m \in \mathbb{N}$?
This should demonstrate that the generic object of a Lawvere theory is not uniquely determined. Rather, it shows that the correct definition of a Lawvere theory is a pair $(\mathcal{L},X)$ consisting of a category with finite products and an object $X \in \mathcal{L}$ such that every object of $ \mathcal{L}$ is isomorphic to some $X^n$. It is not enough to state the existence of such an object as a property.
I am not sure if this answers the question (does it?), but in any case there must be simpler examples (since here any category can be chosen).
Edit. In fact, a theorem of Ketonen implies that there are boolean algebras $A$ such that $A \cong A^4$ and $A \not\cong A^2$, and then $X := A$ and $Y := X^2$ are a counterexample. I am looking for an answer which either explains this algebra $A$ in a self-contained way and gives a proof of $A \not\cong A^2$ and $A \cong A^4$, or (perhaps even) better gives an example in a more elementary category.
Solution 1:
Why not take the free category with finite products generated by an object $X$ and an isomorphism $X\cong X^4$? Then taking $Y = X^2$, we have $X\cong Y^2$, but $X\not\cong Y$ (because there some object $A$ in some category with finite products in which $A\cong A^4$ but $A\not\cong A^2$, as shown in this answer to the question you linked to - e.g. in the category of Boolean algebras, by the theorem of Ketonen).
This is the Lawvere theory of $4$-ary Jónsson-Tarski algebras. It can be presented as an algebraic theory in a language with a $4$-ary operation $\mu$ and $4$ unary operations $\pi_1, \pi_2, \pi_3, \pi_4$ and equations $\mu(\pi_1(x),\pi_2(x),\pi_3(x),\pi_4(x)) = x$ and $\pi_i(\mu(x_1,x_2,x_3,x_4)) = x_i$ for $1\leq i \leq 4$.
Solution 2:
Here is a fairly simple explicit example (I believe it is equivalent to Alex Kruckman's example, but it gives an explicit set-theoretic construction that makes it easier to see why $X$ and $Y$ are not isomorphic). For convenience I will consider the dual question with coproducts instead of products. Let $A$ be a set with $4$ elements and let $X=A^\mathbb{N}$. Note that for each $n\in\mathbb{N}$, we have a canonical bijection $A^n\times X\to X$ given by concatenation of sequences. If $T$ is a set, we can think of $T\times X$ as consisting of $|T|$ copies of $X$, but we can also think of it as consisting of $4|T|$ copies of $X$ by identifying it with $T\times A\times X$, or as consisting of $16|T|$ copies of $X$ by identifying it with $T\times A^2\times X$, or as consisting of $4^n|T|$ copies of $X$ for any $n$ by identifying it with $T\times A^n\times X$. Say that a copy of $X$ in $T\times X$ has depth $n$ if it is one of the $4^n|T|$ copies obtained in this way. Say that a function $f:X\to T\times X$ is good if it is the inclusion of a copy of $X$ at some depth. That is, $f$ is good if there exists $t\in T$ and a finite sequence $a\in A^n$ for some $n$ such that $f(x)=(t,ax)$ for all $x\in X$, where $ax$ denotes the concatenation of $a$ and $x$. Note that if we take a good function and restrict it to one of the copies of $X$ inside $X$ (identifying $X$ with $A^m\times X$ for some $m$), we get another good function, since this corresponds to just extending the finite sequence $a$ used.
Our category has as objects the sets of the form $S\times X$ where $S$ is finite. The morphisms are the locally good functions: that is, functions that are good when restricted to each copy of $X$ in $S\times X$ of sufficiently large depth. More precisely, a function $f:S\times X\to T\times X$ is locally good if for some $n$, if we identify $S\times X$ with $(S\times A^n)\times X$ via concatenation, then the restriction of $f$ to $\{a\}\times X$ is good for each $a\in S\times A^n$. Since the restriction of a good function to a smaller copy of $X$ is still good, a locally good function $f$ which satisfies the definition above for some depth $n$ will also satisfy it for any larger $n$. It follows that the composition of two locally good functions is good, since you can choose $n$ large enough for the first function such that it maps each copy of $X$ into a copy of $X$ on which the second function is also good. Since locally good functions can be defined independently on each of the copies of $X$ making up their domain, $(S\sqcup T)\times X$ is a coproduct of $S\times X$ and $T\times X$ in this category. The intuition here is that our category knows that $X\sqcup X\sqcup X\sqcup X\cong X$ via the canonical bijection $A\times X\to X$, and only contains the morphisms that can be built out of this isomorphism by decomposing the domain and codomain using this isomorphism repeatedly and then mapping each copy of $X$ in the domain to one of the copies in the codomain via the identity.
Now suppose $f:S\times X\to T\times X$ is an isomorphism in this category. Then $f$ is a bijection, and there exists $n$ such that $f$ is good on each copy of $X$ of depth $n$ in $S\times X$. So, $f$ maps each copy of $X$ of depth $n$ in $S\times X$ to some copy of $X$ in $T\times X$. We would like to "count" the copies of $X$ that $f$ is pairing up in order to get some relationship between $|S|$ and $|T|$. We have $4^n|S|$ copies of $X$ of depth $n$ on which $f$ is good, but our counting is complicated by the fact that the images of these copies under $f$ might not all have the same depth in $T\times X$. However, we can think of copies of low depth as just consisting of many copies of higher depth (since each time we increase the depth we split each copy of $X$ into $4$ copies). Picking $m$ large enough such that all our copies in $T\times X$ have depth at most $m$, if $f$ maps a copy of $X$ to a copy of $X$ of depth $i$, we can think of it instead as mapping it onto $4^{m-i}$ copies of depth $m$. So we have $4^n|S|$ copies in our domain and $4^m|T|$ copies in our codomain, and each copy in the domain is mapped onto a power of $4$ number of copies in the codomain. This means that $f$ decomposes the integer $4^m|T|$ as a sum of $4^n|S|$ integers, all of which are powers of $4$. Reducing this sum mod $3$, this means that $|S|$ and $|T|$ must be the same mod $3$.
So, in particular, $X\not\cong X\sqcup X$ in this category. On the other hand, since $A\times X\cong X$ via concatenation, we do have $X\cong X\sqcup X\sqcup X\sqcup X$. So taking $Y=X\sqcup X$, each of $X$ and $Y$ is a coproduct of two copies of the other, but $X$ and $Y$ are not isomorphic.
(More generally, if you take $A$ to have $N$ elements instead of $4$, then this category will satisfy $S\times X\cong T\times X$ iff $S$ and $T$ are either both empty or both nonempty and $|S|$ and $|T|$ are the same mod $N-1$. You are then just asking for two distinct residues mod $N-1$ which are each multiples of each other, which exist as long as $N\geq 4$.)