$A$ and $B$ commute on a dense set but $e^{iA}$ and $e^{iB}$ do not

Let $A$ and $B$ be unbounded, symmetric operators on a Hilbert space $H$ with a common domain $D$. If $AB = BA$ on $D$, is it necessarily that case that $e^{iA}$ and $e^{iB}$ also commute? If $A$ and $B$ are bounded, then I know that this must be the case. However, I am not sure if the same must be true for unbounded operators. Does anyone have a proof or a counterexample?

-
No, it's not necessarily the case. Nelson produced some counterexamples which are discussed in Reed and Simon, vol 1, section VIII.5. There's an nlab-page outlining the idea (the discussion seems to follow Reed and Simon quite closely). –  Martin Jan 8 '13 at 7:10
One would have to require $A$ and $B$ to be self-adjoint and not just symmetric in order for $e^{i A}$ and $e^{i B}$ to be defined. –  Berrick Fillmore Dec 13 '13 at 8:14

Let $H=L^{2}[0,\pi]$. The subspace $D=\mathcal{C}^{\infty}_{c}(0,2\pi)$ consisting of infinitely-differentiable functions on $(0,2\pi)$ which are compactly supported in $(0,2\pi)$ is a dense subspace of $H$. Let $\mathcal{D}(A$) be the domain of twice absolutely continuous functions on $[0,2\pi]$ for which $$f'\in H, f'' \in H, f(0)=f(\pi)=0.$$ Let $\mathcal{D}(B)$ be the domain of twice absolutely continuous functions on $[0,2\pi]$ for which $$f'\in H, f'' \in H, f'(0)=f'(\pi)=0.$$ Let $A$ and $B$ be $-\frac{d^{2}}{dx^{2}}$ on their respective domains. Both operators are selfadjoint, and $Af=Bf$ for all $f \in D$. The operator $A$ has a complete orthonormal basis consisting of $$a_{n}(x) = \sqrt{\frac{2}{\pi}}\sin(n x),\;\;\; n=1,2,3,\ldots\;.$$ The operator $B$ has a complete orthonormal basis of eigenfunctions $$b_{0}=\sqrt{\frac{1}{\pi}},\;\;b_{n}(x) = \sqrt{\frac{2}{\pi}}\cos(n x),\;\;\; n =1,2,3,\ldots\;.$$ The operators $e^{iA}$ and $e^{iB}$ applied to $f\in H$ are given by $$e^{iA}f = \sum_{n=1}^{\infty}\left[\frac{2}{\pi}\int_{0}^{\pi}f(t)\sin(nt)\,dt\right] e^{in^{2}}\sin(nx), \\ e^{iB}f = \frac{1}{\pi}\int_{0}^{\pi}f(t)\,dt+ \sum_{n=1}^{\infty}\left[\frac{2}{\pi}\int_{0}^{\pi}f(t)\cos(nt)\,dt\right]e^{in^{2}}\cos(nx).$$ In particular, $e^{iB}1=1$ because $1$ is an eigenfunction of $B$ with eigenvalue $0$. For $n \ge 1$, $$\left.\frac{2}{\pi}\int_{0}^{\pi}\sin(nt)dt = -\frac{2}{n\pi}\cos(nt)\right|_{0}^{\pi}=2\frac{1-(-1)^{n}}{n\pi}$$ So, $e^{iB}\ne e^{iA}$ because $$e^{iB}1=1 = 2\sum_{n=1}^{\infty}\frac{1-(-1)^{n}}{n\pi}\cos(nx),\\ e^{iA}1=2\sum_{n=1}^{\infty}\frac{1-(-1)^{n}}{n\pi}e^{in^{2}}\cos(nx).$$