4. Let $x \geqslant 0, y \geqslant 0$, and $x+2 y=\frac{1}{2}$, then the maximum value of the function $u=\log _{\frac{1}{2}}\left(8 x y+4 y^{2}+1\right)$ is
A. $\log \frac{1}{\frac{1}{2}} \frac{4}{3}$
B. 0
C. 1
D. $\log \frac{1}{2} \frac{3}{4}$
4. B $x+2 y=\frac{1}{2}, y=\frac{1}{4}-\frac{1}{2} x$, from $x \geqslant 0$ we know, $y \leqslant \frac{1}{4}$. Substituting $x=\frac{1}{2}-2 y$ into $u$, $u=\log _{\frac{1}{2}}\left(-12 y^{2}+\right.$ $4 y+1)$. Let $-12 y^{2}+4 y+1>0$, thus $y \in\left[0, \frac{1}{4}\right] \cdot-12 y^{2}+4 y+1 \in\left[1, \frac{4}{3}\right] \cdot \log \frac{1}{2} \frac{4}{3} \leqslant u \leqslant 0$.