Define recursive function prefix. I need to define a recursive function, over strings, prefix in that way $\mathrm{prefix}(x,y) = \mathrm{true}$ if $x$ is prefix of $y$. This is my approach so far:
$\mathrm{prefix}([ ],y) = \mathrm{true} \text{ (Base Case)}, \\
\mathrm{prefix}(x,[ ]) = \mathrm{true}  \text{ (Base Case)}, \\
\mathrm{prefix}(x::l,y::m) = \text{if } (l=m) \text{ then }\mathrm{prefix}(x,y) \text{ else } \mathrm{false}.$
The last line worries me.

$\mathrm{prefix}(x,[])$ should be $\mathrm{false}$, since no matter what $x$ is, it can never be a prefix of $[]$.
I would do the recursive case like this.
$$\mathrm{prefix}(x::l,y::m) = \left\{
     \begin{array}{lr}
       \mathrm{prefix}(l,m) & \text{if } x = y\\
       \mathrm{false} & \text{if } x \neq y
     \end{array}
   \right.$$
Remember that $x$ is a prefix of $y$ if some of the beginning of $y$ is exactly the same as $x$, which we could also write as $y = x::z$ for some string $z$. So in order to do the recursive step, we check if the first two symbols of $x$ and $y$ agree, and if they do, then we check the next two symbols recursively, and we keep doing this until one of the strings is empty. If it is $x$ that is empty, then we have positively checked that all of $x$ is included in the beginning of $y$. If it is $y$ that is empty, then this check has failed.
