4. Find the range of real numbers $a$ such that the inequality
$$
\begin{array}{l}
\sin 2 \theta-(2 \sqrt{2}+a \sqrt{2}) \sin \left(\theta+\frac{\pi}{4}\right)-2 \sqrt{2} \sec \left(\theta-\frac{\pi}{4}\right) \\
>-3-2 a
\end{array}
$$

holds for all $\theta \in\left[0, \frac{\pi}{2}\right]$.
(2000, Tianjin High School Mathematics Competition)
(Let $x=\sin \theta+\cos \theta$. Since $\theta \in\left[0, \frac{\pi}{2}\right]$, then $x \in[1, \sqrt{2}]$. Thus, $\sin 2 \theta=x^{2}-1, \sin \left(\theta+\frac{\pi}{4}\right)=$ $\cos \left(\theta-\frac{\pi}{4}\right)=\frac{x}{\sqrt{2}}$. The original inequality can be transformed into $(x-2)$. $\left(x+\frac{2}{x}-a\right)>0$. Also, $x-2x+\frac{2}{x}$, $(f(x))_{\max }=\left(x+\frac{1}{x}\right)_{\max }=f(1)=3$. Therefore, $a>3$.)