Please do not provide a full solution, I would just like a hint to set me on the right path. Working on an exercise in Lang's Algebra book, I am trying to prove that four conditions are equivalent, in order to prove Lazard's theorem: a module is flat if and only if it is a direct limit of finite free modules. (Chapter 16 exercise 13). There is one implication that has given me a lot of difficulty. There is a hint in the book that says this step should be easy from the hypothesis. It is as follows.
$P$ is finitely presented, $E$ is arbitrary, all modules are over a commutative ring $A$. Suppose that $\text{Hom}(P,A)\otimes E\to\text{Hom}(P,E)$ is surjective. Let $f\in\text{Hom}(P,E)$. Then there exists a free module $F$ and homomorphisms $g:P\to F$, $h:F\to E$ such that $f=h\circ g$.
My initial thought was to let $F$ be the free module that maps surjectively onto $P$ in the finite presentation. We can write $f=\alpha\otimes e\in\text{Hom}(P,A)\otimes E$ by assumption. Then if $\pi:F\to P$ is the surjection in the finite presentation, we would have a candidate for $h$, namely $(\alpha\circ\pi)\otimes e\in\text{Hom}(F,E)$. The problem is that, for this to work, $P$ would have to embed into $F$. But then the sequence of the finite presentation would have to split, which I do not think is generally true. So this will not work. I've been stuck on this for a while, and the hint makes me think I am missing something obvious. A proper hint would be much appreciated.
Hint:
By hypothesis, there are linear forms $v_1,\dots,v_n\in\operatorname{Hom}_A(P,A)$ and vectors $w_1,\dots w_n\in E$ such that $$f(x)=\sum_{i=1}^n v_i(x) w_i\quad\forall x\in P.$$
Consider the map \begin{align} g:P&\longrightarrow A^n, \\ x&\longmapsto\bigl(v_1(x),\dots,v_n(x)\bigr). \end{align}