4. Let the set $A=\left\{(x, y) \left\lvert\,\left\{\begin{array}{l}x=\sec \theta, \\ y=\tan \theta,\end{array}\right.\right.\right.$
$$
\begin{array}{l}
0 \leqslant \theta < \pi\right.\right\}, B= \\
\left\{(x, y) \mid y^{2} \leqslant 3(x+3)\right\}, D=A \cap B \cap C .
\end{array}
$$

When $(x, y) \in D$, then the maximum value of $y-2 x$ is
4. $y-2x$ attains its maximum value $4+\sqrt{\overline{3}}$ at point $M(-2, \sqrt{\overline{3}})$,