Universal property of free module, "converse" Let $F$ be a free $R$-module with a basis $B$. We know that $B$ satisfies the following property:

For any $R$-module $M$ and any $g:B\rightarrow M$, there exists a unique $R$-map $\varphi:F\rightarrow M$ that extends $g$.

Now suppose that $F$ is any $R$-module and $B$ is any subset of $F$. If $B$ satisfies the above property, is $B$ a basis of $F$?
I think this is true for vector spaces. If $B$ doesn't span $F$ then there is no unique extension of $g$, and if $B$ is linearly dependent then the extension might not exist at all. But I'm having trouble extending my reasoning to modules, due to the lack of division and the presence of torsion elements.
 A: Juan S's comment is correct. For any set $B$ let me denote by $F(B)$ the free module on that set. In this case there is a canonical map $f : F(B) \to F$, and your hypotheses say that the induced maps
$$f^{\ast} : \text{Hom}_{R\text{-Mod}}(F, M) \to \text{Hom}_{R\text{-Mod}}(F(B), M) \cong \text{Hom}_{\text{Set}}(B, M)$$
are bijections for every $M$. By the Yoneda lemma, $f$ must be an isomorphism. Explicitly, take $M = F(B)$ in the above; then $(f^{\ast})^{-1}(\text{id}_{F(B)})$ is an inverse to $f$. 
A: I'm pretty sure that it also works without Yoneda lemma:
Just consider  $F/N$, where $N = (B)$, the R-module generated by B and a map $\psi: B \rightarrow F/N $. $\psi$ sends all $ x \in B$ to $0$, so it's the zero map.
We now extend $\psi$ in two ways:


*

*set $\phi_{1}: F \rightarrow F/N$ by mapping everything to $0$. This extends $\psi$

*let $\phi_{2}: F \rightarrow F/N$ be the canonical epimorphism. This also extends $\psi$


By the above property, the extension has to be unique, so $\phi_{1} = \phi_{2}$.
Since the canonical epimorphism is then the zero map, it holds: $F = N$.
For R-linear independence let
$$\sum_{\text{finite}} r_{i}x_{i} = 0\;,\qquad r_{i}\in R, \:\, x_{i} \in B$$
Now let $r_{j}$ be one of the coefficients and define the map 
$$\gamma_{j}:B\rightarrow R:x\mapsto\left\{\begin{array}{ll} 1, & x = x_{j} \\ 0, & x\neq x_{j}\end{array}\right.$$
Then again by above property this extends to: $F_{j}:F\rightarrow R$. And finally it holds
$$0 = F_{j}(0) = F_{j}\left(\sum_{\text{finite}} r_{i}x_{i}\right) = \sum_{\text{finite}}r_{i}F_{j}(x_{i}) = r_{j}$$
So B is a basis of F.
