What is the coproduct in the category of triples $(B , M , d)$?

Let's start with coproducts in the category of commutative $A$-algebras. These are described in this answer by Eric Wofsey. You can think of an infinite coproduct of commutative $A$-algebras $\bigsqcup_{i\in I} B_i$ as the directed colimit of all the finite tensor products $B_{i_1}\otimes_A\dots \otimes_A B_{i_n}$, or as the subring of the "infinite tensor product" $\otimes_A B_i$ generated by the pure tensors $\otimes b_i$ such that $b_i = 1_{B_i}$ for all but finitely many $i\in I$.

Let's write $c_i\colon B_i\to \bigsqcup_{i\in I} B_i$ for the canonical $A$-algebra homomorphism to the coproduct.


Next, let's consider the category of pairs $(B,M)$, where $B$ is a commutative $A$-algebra and $M$ is a $B$-module. An arrow $(B,M)\to (B',M')$ is a pair $(f,g)$, where $f\colon B\to B'$ is an $A$-algebra homomorphism and $g\colon M\to M'$ is a $B$-module homomorphism (viewing $M'$ as a $B$-module by restricting scalars along $f\colon B\to B'$).

Given a family $(B_i,M_i)_{i\in I}$, let $B = \bigsqcup_{i\in I}B_i$. Now let $N_i = B\otimes_{B_i} M_i$, the $B$-module obtained from $M_i$ by extension of scalars along $c_i\colon B_i\to B$, and let $M = \bigoplus_{i\in I} N_i$, the coproduct in the category of $B$-modules. For each $i$, we have a $B_i$-module homomorphism $M_i\to N_i$ (by $m\mapsto 1_B\otimes m$) and a $B$-module homomorphism $N_i\to M$. Composing these gives a $B_i$-module homomorphism $c_i'\colon M_i\to M$.

I claim that the coproduct $\bigsqcup_{i\in I} (B_i,M_i)$ is $(B,M)$, where for each $i$, the canonical arrow to the coproduct is $(c_i,c_i')$.

Suppose we have a family of arrows $(f_i,g_i)\colon (B_i,M_i)\to (B',M')$. By the universal property of the coproduct of commutative $A$-algebras, we obtain a unique arrow $\bigsqcup f_i\colon B\to B'$ such that $(\bigsqcup f_i)\circ c_i = f_i$ for all $i$. Restricting scalars along $\bigsqcup f$, we can view $M'$ as a $B$-module. So by the universal property of extension of scalars, the $B_i$-module homomorphism $g_i\colon M_i\to M'$ induces a $B$-module homomorphism $h_i\colon N_i\to M'$. By the universal property of the coproduct of $B$-modules, we obtain a $B$-module homomorphism $\bigoplus h_i\colon M\to M'$. Tracing through, we find that $(\bigoplus h_i)\circ c_i' = g_i$ for all $i$, and $\bigoplus h_i$ is unique with this property.


Finally, we consider your category of triples $(B,M,d)$, where $(B,M)$ are as above, $d$ is an $A$-linear derivation $B\to M$, and arrows are pairs $(f,g)$ as above but satisfying $d(f(b)) = g(d(b))$.

Given a family $(B_i,M_i,d_i)_{i\in I}$, I claim that we can define a derivation $d\colon B\to M$ on the coproduct in the category of algebra-module pairs defined above, in such a way that $(B,M,d)$ is the coproduct in the category of algebra-module-derivation triples.

The definition of $d$ is forced on us: In order to have each $(c_i,c_i')$ continue to be an arrow $(B_i,M_i,d_i)\to (B,M,d)$, we must have $d(c_i(x)) = c_i'(d(x))$. But since the coproduct $\bigsqcup_{i\in I} B_i$ is generated by elements of the form $c_i(x)$ with $x\in B_i$, we can extend this definition by $A$-linearity and the Liebniz rule for multiplication. Concretely, suppose we have a finite-length pure tensor $b_{i_1}\otimes \dots \otimes b_{i_n}$. Then \begin{align*} d(b_{i_1}\otimes \dots \otimes b_{i_n}) &= d\left(\prod_{j=1}^n c_{i_j}(b_{i_j})\right)\\ &= \sum_{k=1}^n \left(\prod_{j\neq k} c_{i_j}(b_{i_j})\right) d(c_{i,k}(b_{i_k}))\\ &= \sum_{k=1}^n \left(\prod_{j\neq k} c_{i_j}(b_{i_j})\right) c'_{i,k}(d(b_{i_k})). \end{align*} This is the element of $M = \bigoplus_{i\in I}N_i$ whose entry in the $i_k$ position is $(b_{i_1}\otimes \dots \otimes 1\otimes \dots \otimes b_{i_n})\otimes d(b_{i_k})$ for $1\leq k\leq n$ and which is $0$ in all other entries. Now this definition is multi-$A$-linear, so it extends to an $A$-linear map $B_{i_1}\otimes_A\dots\otimes_A B_{i_n}$, and it is uniform across the directed colimit (i.e., unaffected by extending a finite-length pure tensor by extra $1$s), so it extends to an $A$-linear map $B\to M$. Finally, one checks that it satisfies the Liebniz rule, so it is an $A$-linear derivation.

It remains to check that the pairs $(c_i,c_i')$ actually preserve $d$ (so they are arrows in our category) and given a family of arrows $(f_i,g_i)\colon (B_i,M_i,d_i)\to (B',M',d')$, the universal arrow $(\bigsqcup f_i,\bigoplus h_i)$ defined above preserves $d$ (so is an arrow in our category). I'll leave these checks to you.


For another perspective on this whole business, we can consider our category of triples $(B,M,d)$ as the category of models for an algebraic theory (aka a variety of algebras, in the sense of universal algebra). I'm going to write this to try to share the intuition I had before I worked out the details of the answer above. It may or may not be helpful to you.

This theory has:

  • Two sorts, $\mathrm{Alg}$ and $\mathrm{Mod}$, for the algebra and the modules.
  • Constant symbols $0,1\in \mathrm{Alg}$ and $0\in \mathrm{Mod}$.
  • Operations $+,\times\colon \mathrm{Alg}^2\to \mathrm{Alg}$, $+\colon \mathrm{Mod}^2\to \mathrm{Mod}$, $(a\cdot)\colon \mathrm{Alg}\to \mathrm{Alg}$ for each element $a\in A$, $\cdot\colon \mathrm{Alg}\times \mathrm{Mod}\to \mathrm{Mod}$, and $d\colon \mathrm{Alg}\to \mathrm{Mod}$.
  • Equational axioms asserting that (a) $\mathrm{Alg}$ is a commutative $A$-algebra, (b) $\mathrm{Mod}$ is a module over $\mathrm{Alg}$, and (c) $d$ is an $A$-linear derivation.

Now every category of models for an algebraic theory has all limits and colimits, so in particular we are guaranteed that infinite colimits exist. Further, the colimit of a family of models has a concrete description as the free model generated by the disjoint union of all the models in the family, modulo relations for the actual term evaluations in the models in the family.

In other words, elements of the coproduct $\bigsqcup_{i\in I} (B_i,M_i,d_i)$ are terms in the elements of the $B_i$ and $M_i$, where two terms are equal if one can be rewritten to the other using our equational axioms and term evaluation in the $B_i$ and $M_i$.

Ok, what is a term of sort $\mathrm{Alg}$? It's a finite $A$-linear combination of products of elements of the $B_i$. Note that if we restrict our attention to the sort $\mathrm{Alg}$, we just have the same operations and axioms as for the theory of commutative $A$-algebras. So we expect our coproduct to have the ordinary coproduct of commutative $A$-algebras in the $\mathrm{Alg}$ sort.

What is a term of sort $\mathrm{Mod}$? Well, we can freely add together elements of different modules (this is where the direct sum comes from), and we can also multiply arbitrary elements of sort $\mathrm{Mod}$ by arbitrary elements of sort $\mathrm{Alg}$ (this is where the extension of scalars comes from). And we can do one more thing, which is convert elements of sort $\mathrm{Alg}$ to sort $\mathrm{Mod}$ using $d$. But by $A$-linearity and the Liebniz rule, if we apply $d$ to a term of sort $\mathrm{Alg}$, we can "distribute the $d$" over addition and multiplication and the action of $A$, until it just applies to an element of some $B_i$, which just evaluates to an element of $M_i$. This suggests that when we form our coproduct, we'll get the same elements as if we were forming coproducts of models of the theory without the derivation.

It was this kind of reasoning that suggested to me that we could focus on finding the coproduct in the category without the derivation, and then add the derivation back on top without changing the underlying set of the coproduct.