For any (commutative, unital) ring $A$, maps $\mathbb{Z}^2\to A$ correspond to idempotent elements of $A$. Also, idempotent elements of $A$ correspond to ways of expressing $A$ as a product of two rings, by mapping an idempotent $e$ to the decomposition $(e)\times (1-e)$, where we treat $(e)$ as a ring with identity $e$. This gives a bijection between $\text{Hom}(\mathbb Z^2,A)$ and the set of product representations of $A$.
More generally, in any category with finite products and initial object $I$, we can define a product decomposition of an object $A$ as an isomorphism class of tuples $(A,B_1,B_2,p_1,p_2)$ with $p_i:A\to B_i$ which form product diagrams. Then for any object $A$, there is a map $F$ from the "set" of product decompositions to $\text{Hom}(I^2,A)$ as follows: given a representative $(A,B_1,B_2,p_1,p_2)$, we have $I\times I \xrightarrow{\pi_i}I\to B_i$ which for $i=1,2$ gives two maps $I\times I\to B_i$, and thus a map $I\times I\to B_1\times B_2=A$.
As noted above, for any object of the category of rings, the $F$ is a bijection. (The set of product decompositions doesn't have a functor structure, so it doesn't seem like we could upgrade this to a natural bijection.) In other categories this is not the case: for example, in the category of sets, the initial object is $\emptyset$ and $\emptyset\times \emptyset=\emptyset$, so $\text{Hom}(I^2,A)$ is always a singleton. However, in $\text{Set}^{\text{op}}$, $F$ is again a bijection, because the coproduct of the final object with itself is a set with 2 elements, and functions from $A$ to a set with two elements correspond, via the above map, with ways of writing $A$ as a disjoint union of two sets. The same thing happens in e.g. the category of topological spaces. (For the same reason that $F$ is trivial in $\text{Set}$, $F$ is trivial in any category with a zero object.)
If we look at something like $\text{Set}\times \text{Set}^{\text{op}}$, $F$ becomes a product projection. (Trying coproduct categories breaks things because there are no longer initial/final objects.)
My questions are the following:
- What conditions on a category/an object of a category ensure that the collection of product decompositions is a set?
- Are there "natural" categories in which the behavior is different from the 3 behaviors above? In particular, can $F$ not be a bijection?
- Is there something deeper going on here?
- Does the fact that this describes a similarity between the opposite of the category of rings and the category of topological spaces indicate that there could be some algebraic geometry hiding somewhere?