Why doesn't this display properly:

```
\begin{equation}
steps(x^{(i)}) = 
    \begin{cases} 
        1                                                    & \mbox{ if } x^{(i)}.g = leaf \\
        1 + \sum_{g \in children(x) } steps(proof\_state(g)) & \mbox{otherwise}
    \end{cases}
\end{equation}

```

I want it to be an equation with cases. It says

```
misplaced alignment tab character &

```

but according to other examples it looks fine to me.