In these notes, page 20, the following exercise is proposed:
Consider the ring of integers $(\mathbb{Z},0,1,+,×,−)$, consisting of the set $\mathbb{Z}$ of integers, the constants 0 and 1, and the operations of addition +: $\mathbb{Z}×\mathbb{Z} → \mathbb{Z}$, multiplication ×: $\mathbb{Z}×\mathbb{Z} → \mathbb{Z}$ and minus − : $\mathbb{Z} → \mathbb{Z}$. Show that ($\mathbb{Z}$,0,1,+,×,−) is an F-algebra, by defining a suitable functor F : Set → Set.
I was wondering if the following functor an morphism solve the problem:
$[0,1,+,*,-]: (1+2+3) + \mathbb{Z}×\mathbb{Z} \to \mathbb{Z}$
where 1,2,3 denote sets of 1,2 and 3 stars * respectively. Then the mapping works as follows:
$(*,(a,b)) \mapsto a+b$
$(**,(a,b)) \mapsto a*b$
$(***,(a,b)) \mapsto -b$
Then the functor would be:
$F(\mathbb{Z}) = (1+2+3) + \mathbb{Z}×\mathbb{Z}$
since this differs from the previous example on the book I was wondering if my approach is at all correct.
$\newcommand{\Z}{\mathbb{Z}}$ The idea is mostly correct, though I'd propose some cleanup. Firstly, when defining your morphism $F(\Z) \to \Z$, you do a case analysis on three possibilities, all of which have $(a, b) \in \Z \times \Z$. That means that the functor should be $F(X) = (1+2+3) \times X \times X$. If it were plus, you'd have an element of $1 + 2 + 3$ or an element of $\Z \times \Z$, rather than an element of $1 + 2 + 3$ and an element of $\Z \times \Z$.
My second proposed change is that you want there to be three different cases. Usually $1$, $2$ and $3$ represent the sets containing $1$, $2$ or $3$ elements respectively, so with what you have, there would be $1 + 2 + 3 = 6$ different cases. Instead, you should use $1 + 1 + 1$, or simply $3 = \{0, 1, 2\}$. Then the map $F(\Z) \to \Z$ is
$$ \begin{aligned} (0, (a, b)) \mapsto a+b \\ (1, (a, b)) \mapsto a * b \\ (2, (a, b)) \mapsto -b \\ \end{aligned} $$
This answers the question, but depending on how you interpret the problem, it might be wrong. If you interpret the problem too loosely, it becomes trivially easy: you could take $F(X) = X$ and the morphism $F(\Z) \to \Z$ can be simply the identity. Really, the functor should somehow use the other structure mentioned in the problem, i.e., the structure of a ring.
For the functor $F$ defined above, an $F$-algebra is a set $X$ with three binary operations $X \times X \to X$. That doesn't sound much like a ring at all! One improvement is to use $F(X) = X \times X + X \times X + X$, in which case we have two binary operations and a unary operation $X \to X$. If we wanted to include all the data given in the problem (that is, $(\Z, 0, 1, +, \times, −)$), then we'd actually want two more nullary operations for $0$ and $1$, so $F(X) = 1 + 1 + X \times X + X \times X + X$.
$$ \begin{aligned} (0) \mapsto 0 \\ (1) \mapsto 1 \\ (2, (a, b)) \mapsto a + b \\ (3, (a, b)) \mapsto a * b \\ (4, a) \mapsto -a \\ \end{aligned} $$
For extra credit - can you ensure that the $F$-algebras are precisely rings? You'll need some way to force the operations to obey the ring axioms.Actually, this may only be possible with algebras for a monad. Algebras for a functor are too loose to characterize rings.