Solution (source code)

= Solution

The <Neyman-Pearson lemma> concerns testing two simple hypotheses with densities $f_0$ and $f_1$ relative to a common measure. A test that rejects when $f_1(x)>k f_0(x)$, accepts when $f_1(x)<k f_0(x)$, and randomizes on equality if necessary to achieve size $\alpha$, is most powerful among all tests with size at most $\alpha$:
$$
\boxed{\mathbb E_0\varphi=\alpha\quad\Longrightarrow\quad
\mathbb E_1\psi\leq\mathbb E_1\varphi\text{ for every test }\psi\text{ with }\mathbb E_0\psi\leq\alpha.}
$$
Here $\varphi$ is the described <likelihood-ratio test> and test functions take values in $[0,1]$. In the <continuous> normal setting below the <boundary> has <probability> zero, so randomization is unnecessary.