Question on Definition of Canonical Epimorphism Let $P$ be a finitely-generated $R$-module, where $R$ is a principal ideal domain.  The text that I am reading refers to
$$
f:\bigoplus_{p \in P}R \rightarrow P
$$
as the canonical epimorphism of $R$-modules, but I'm not sure what this map is supposed to be exactly.  Since $(P, +)$ is an abelian group with identity 0 my first thought was to define
$$
f(p_1, p_2, ...) = (p_1 + p_2 + ...)0
$$
but this is always equal to 0 and therefore definitely not surjective.  My question is if I don't know anything about the $R$-module $P$, then how can I canonically define this mapping so that it is surjective?
 A: In general $P$ can be infinite or even uncountable, so probably the best way to write an element of $\bigoplus_{p\in P}R$ is a map $g\colon P\to R$ which has $g(p)=0$ for all but finitely many $p\in P$. Then $f(g)=\sum_{p\in P} r\cdot p$. (Note: $g$ is not a homomorphism of modules or anything; it's just a set map with the added property that it's almost always zero.)
For example, suppose $P=\Bbb Z/3$. Then we can write the domain of $f$ as $R_0\oplus R_1\oplus R_2\oplus R_3$, and have $f(r_1,r_2,r_3,r_4)=r_1+2r_2+3r_3$.
In general, $f$ is certainly an epimorphism: given $p\in P$, let $g\colon P\to R$ be the map taking $p$ to $1$ and every other element to $0$. Then $f(g)=p$.
More commonly, you will see people start with a set of generators for $P$ like $p_1,\ldots,p_n$, in which case we have a surjective map $R^n\to P$ given by $(r_1,\ldots, r_n)\mapsto r_1p_1+\cdots+r_n p_n$. The only issue is that this depends on a choice of generators for $P$, hence why the author refers to $f$ here as the canonical epimorphism.
