I know that if a distribution (generalized function) has zero derivative, then it is a constant. I also know the proof. But I have a hard time finding a reference which contains a statement of this fact. Any thoughts? Thanks.
Update:
I indeed found it in "Théorie des distributions" by L. Schwartz. Section 2.4, Theorem 1.
Ok, you said you knew how to prove it. Others may not. And you may like this better than what you have (it's the second thing I always think of when this comes up, and I like it a lot better than the first thing I think of...)
Say $u$ is a distribution and $u'=0$. By definition $u(\phi')=0$ for any test function $\phi$. Hence $u(\phi)=0$ for any test function $\phi$ with $\int\phi=0$.
Fix $\psi_0$ with $\int\psi_0=1$, and let $c=u(\psi_0)$. Now for an arbitrary test function $\phi$, let $\alpha=\int\phi$. Then $u(\alpha\psi_0-\phi)=0$, which says $$u(\phi)=c\int\phi.$$Which is exactly what "$u=c$" means.
Detail: We used the following fact above: Given a test function $\phi$ on $\Bbb R$, there exists a test function $\psi$ with $\phi=\psi'$ if and only if $\int\phi=0$. In case this is not clear: First, if $\phi=\psi'$ then $\int\phi=\int\psi'=0$ because $\psi$ has compact support. Suppose on the other hand that $\int\phi=0$, and define $\psi(x)=\int_{-\infty}^x\phi$. Then $\psi'=\phi$ and hence $\psi$ is infinitely differentiable, while the fact that $\int\phi=0$ shows that $\psi$ has compact support.