4. The function $f$ defined on the set of real numbers $\mathbf{R}$ satisfies, for every $x \in \mathbf{R}$ and constant $a>0$,
$$
f(x+a)=\frac{1}{2}+\sqrt{f(x)-f^{2}(x)} .
$$

If the range of the function $f$ is denoted by $M$, then ().
(A) $\frac{\pi}{7} \in M$
(B) $\frac{\sqrt{2}}{3} \in M$
(C) $\frac{\sqrt{2}}{2} \in M$
(D) $\frac{\pi}{3} \in M$
4. C.

Notice,
$$
f(x+a)=\frac{1}{2}+\sqrt{f(x)-f^{2}(x)} \geqslant \frac{1}{2},
$$

i.e., for any $x \in \mathbf{R}$, $f(x) \geqslant \frac{1}{2}$.
$$
\begin{array}{l}
\text { By } f(x)-f^{2}(x) \geqslant 0 \\
\Rightarrow f(x)(1-f(x)) \geqslant 0 .
\end{array}
$$
$$
\text { By } f(x) \geq \frac{1}{2}>0
$$
$$
\begin{array}{l}
\Rightarrow 1-f(x) \geqslant 0 \\
\Rightarrow f(x) \leqslant 1
\end{array}
$$

It is easy to see that, $\frac{\pi}{7}1$.
And $\frac{1}{2}<\frac{\sqrt{2}}{2}<1$, so the answer is C.