Prove that $\texttt{prefix}(L)$ is regular
It appears that $prefix(L)$ is non-regular. 

Let $L = \{0^n 1^n: n \ge 0\}$.  Then, $prefix(L)$, defined to be the set of all prefixes of strings in $L$, is the set of all strings that consist of zero or more $0$'s followed by at most the same number of $1$'s, i.e. $prefix(L) = \{0^n 1^m: m \le n\}$. Intuitively, the reason $prefix(L)$ is nonregular is that a machine that can check whether the number of $1$'s does not exceed the number of $0$'s must store a count of the number of $0$'s in the input seen so far, and so this language cannot be recognized by a machine with a finite number of states.

A formal proof that $L' := prefix(L)$ is nonregular is as follows.  Consider the subset $S = \{0^1, 0^2, \ldots, 0^p\}$.  Any DFA $M$ that recognizes $L'$ must take the inputs $0^i$ and $0^j$ $(i &lt; j)$ to different states because $0^i 1^j \notin L'$ but $0^j 1^j \in L'$.  Hence, the machine $M$ contains at least $p$ states.  But $p$ was arbitrary. This proves there does not exist a DFA (with a finite number of states) recognizing $L'$. 

This proof method requires us to find an infinite subset $S$ of pairwise distinguishable prefixes; see online about the Myhill-Nerode theorem.