Solution (source code)

= Solution

Let $X_i=Y_i-\theta_0$. Under the symmetric continuous <null hypothesis>, positive and negative signs have probability $1/2$ and zeros have probability zero. For the <sign test>, take $N_+=\sum_i\mathbf1_{\{X_i>0\}}$ and reject for small values: $N_+\sim\operatorname{Bin}(n,1/2)$ under the null. Choose $k$ with $\mathbb P_0(N_+\leq k)\leq\alpha$; randomization at the next value attains exact size if desired. The lower tail is appropriate for $\theta<\theta_0$.

For the <Wilcoxon signed-rank test>, rank $|X_i|$ increasingly and put $W_+=\sum_iR_i\mathbf1_{\{X_i>0\}}$. Continuous observations have no absolute-value ties almost surely. Conditional on the absolute values, the signs are <independent> fair signs because symmetry makes the sign <independent> of magnitude. Hence $W_+$ has the distribution of $\sum_{r=1}^nrB_r$ for <independent> <Bernoulli random variables> $B_r$ with parameter $1/2$. Again reject in the lower tail, using this exact subset-sum distribution or a <normal approximation>. <Independence> gives the requested null moments:
$$
\boxed{\mathbb E_0W_+=\frac12\sum_{r=1}^nr=\frac{n(n+1)}4,\qquad
\operatorname{Var}_0W_+=\frac14\sum_{r=1}^nr^2=\frac{n(n+1)(2n+1)}{24}.}
$$
For a symmetric kernel $h$ of fixed order $m$, a one-sample <U-statistic> is $U_n=\binom nm^{-1}\sum_{i_1<\cdots<i_m}h(X_{i_1},\ldots,X_{i_m})$. State the <U-statistic central limit theorem>: if $\mathbb Eh^2<\infty$, $\eta=\mathbb Eh$, and $\zeta_1=\operatorname{Var}(\mathbb E[h\mid X_1])>0$, then $\sqrt n(U_n-\eta)\Rightarrow N(0,m^2\zeta_1)$. The nondegeneracy condition is important.

For $h(x,y)=\mathbf1_{\{x+y>0\}}$, its order-two <U-statistic> satisfies the exact <Wilcoxon signed-rank statistic> identity
$$
W_+=N_++\binom n2U_n.
$$
To prove it, in an unordered pair the sign of the sum is the sign of whichever observation has larger absolute value. Counting the pairs for which a positive observation is larger contributes its rank minus one; its own positive-sign indicator supplies the remaining one.

Write $F_0$ for the distribution function of $X$ under the null. Symmetry gives $\eta=1/2$ and
$$
\mathbb E[h(x,X_2)]-\frac12=1-F_0(-x)-\frac12=F_0(x)-\frac12.
$$
The <probability integral transform> makes $F_0(X_1)$ uniform on $(0,1)$, so $\zeta_1=1/12$. Therefore $\sqrt n(U_n-1/2)\Rightarrow N(0,1/3)$. The centred $N_+$ is $O_p(\sqrt n)$ and is negligible on the scale $n^{3/2}$ of $W_+$. Combining the exact decomposition and its mean gives
$$
\boxed{\frac{W_+-n(n+1)/4}{\sqrt{n(n+1)(2n+1)/24}}\Rightarrow N(0,1).}
$$
The lower-tail approximate level-$\alpha$ rejection rule compares this standardized statistic with $\Phi^{-1}(\alpha)$; a half-unit continuity correction can refine discrete-tail calculations.