Algebraic structures as T-algebras I'm reading about $T$-algebras, defined as a pair of an object $c$ and a morphism $f:Tc \to c$, where $T$ is an endofunctor.
It can be shown that it's a generalization of algebraic structures. For example is $G$ is a group, then, in category of sets and functions that group is $(G, f:1 + G + G \times G \to G)$, where $+$ is a coproduct and $\times$ is a product (so $T$ is a functor $G \mapsto 1 + G + (G \times G)$).
My question is, for example, if we take a ring, the functor becomes $G \mapsto 1 + 1 + G + (G \times G) + (G \times G)$. Aren't in category of sets and functions coproducts disjoint unions? If so, how could $(G \times G) + (G \times G)$ be a valid construction?
 A: The disjoint union of two sets $X$ and $Y$ is not $X \cup Y$ together with the assertion that $X$ and $Y$ are disjoint. While it's true that $X + Y$ is (at least isomorphic to) $X \cup Y$ in the case that $X$ and $Y$ are disjoint, $X + Y$ only needs to contain subsets isomorphic to $X$ and $Y$ which are disjoint from each other.
$X + Y$ can be constructed in all cases as $(X \times \{0\}) \cup (Y \times \{1\})$, that is, as a subset of $(X \cup Y)\times \{0, 1\}$. What we're doing here is making isomorphic copies $X \times \{0\}$ and $Y \times \{1\}$ of $X$ and $Y$ which are disjoint from each other by construction.
So for example, $\{1\} + \{1\}$ is a two element set. More generally, if $X$ and $Y$ are finite, $X + Y$ has cardinality equal to the sum of the two cardinalities. This applies no matter what $X$ and $Y$ are, even if they aren't disjoint.
A: There is no issue with taking the disjoint union of twice the same set (so with your notation, something like $A+A$).
When we say that $A+B$ is the disjoint union of $A$ and $B$, in this context it does not mean that $A$ and $B$ are disjoint sets, and $A+B$ is their usual union. Instead, the disjoint union is a special operation, which is precisely defined to be able to "make non-disjoint sets disjoint". When you take $A+B$, you actually take copies of $A$ and $B$ which are made to be disjoint, even if $A=B$ for instance. One standard way to do that is to take some fixed set with two elements, say $\{0,1\}$, and to define
$$A+B = (A\times\{0\})\cup (B\times\{1\})\subset (A\cup B)\times \{0,1\}.$$
That way, even if $A$ and $B$ have a non-empty intersection (in fact, even if they are equal), you can distinguish the two copies because if $x\in A\cap B$, $x$ corresponds to two elements $(x,0)$ and $(x,1)$ in $A+B$ which are really distinct. We then say that $(x,0)$ is the copy of $x$ in the $A$ component of $A+B$, and $(x,1)$ is the copy in the $B$ component.
But this is just an example of construction, it does not matter how the sausage is made under the hood, what matters is that there are two canonical injections $i_A:A\to A+B$ and $i_B:B\to A+B$, such that $i_A(A)\cap i_B(B)=\emptyset$ and $i_A(A)\cup i_B(B)=A+B$. In the previous construction, $i_A(x)=(x,0)$ and $i_B(x)=(x,1)$.
