Define the function $\operatorname{rev}_s:$ string $\rightarrow$ string by
$$
\begin{aligned}
\operatorname{rev}_s(\sigma)= & {[\text { if length }} \\
& \text { else } \operatorname{append}_s(\sigma)=1 \text { then } \sigma \\
& \left.\left.\operatorname{rev}_s\left(\operatorname{tail}_s(\sigma)\right), \operatorname{head}_s(\sigma)\right)\right] .
\end{aligned}
$$
1. Compute $r e v_s\left({ }^{\prime} a b c d\right.$ ').
2. Let $\alpha_1 \alpha_2 \cdots \alpha_k$ be an informal description of an arbitrary string, where the $\alpha_i$ are elements of char. Using this kind of informal description, say what $\operatorname{rev}_s\left(\alpha_1 \alpha_2 \cdots \alpha_k\right)$ is.
3. What is $\operatorname{rev}_s\left(\right.$ append $_s\left(' a b c^{\prime}\right.$, ' $\left.\left.x y '\right)\right)$ ?
4. Theorem. For any strings $\sigma, \gamma$,
$$
\operatorname{rev}_s\left(\operatorname{append}_s(\sigma, \gamma)\right)=\operatorname{append}_s\left(\operatorname{rev}_s(\gamma), \operatorname{rev}_s(\sigma)\right) .
$$ [Remarks. The text has already proved that append ${ }_s$ is associative. Although it is easy to program the reversing function according to the above definition, the resulting procedure is computationally inefficient, and for this reason is often called naive reverse. There are faster ways to reverse strings.]