Four, as shown in the figure, in $\triangle A B C$, $\angle A=90^{\circ}$, $A D \perp B C$ at $D, P$ is the midpoint of $A D$, $B P$ intersects $A C$ at $E, E F \perp B C$ at $F, A E=3, E C=12$. Find the length of $E F$.
Extend $F E, B A$ to intersect at point $H$,
$\left.\begin{array}{l}A D \| H F \\ P \text { is the midpoint of } A D\end{array}\right\} \Rightarrow H E=E F$.
Also, $\angle H A C=90^{\circ}$ ?
$\left.\begin{array}{l}\angle E F C=90^{\circ} \\ \text { and on the same side of } H C\end{array}\right\} \Rightarrow H, A, F, C$ are concyclic
$$
\begin{array}{l}
\Rightarrow H E \cdot E F=A E \cdot E C, \\
\quad \therefore E F^{2}=A E \cdot E C=3 \times 12=36 \\
\Rightarrow E F=6 .
\end{array}
$$