Let $H$ be Hilbert space and $A$, $B$ - self-adjoint (bounded or unbounded) operators on $H$. According to spectral theorem for every bounded Borel function $f: \mathbb{R}\to \mathbb{R}$ we have $$f(A) = \int d \mu_A(\lambda) ~f(\lambda) $$ $$f(B) = \int d \mu_B(\lambda) ~f(\lambda) $$ where $\mu_A$, $\mu_B$ are spectral measures of $A$ and $B$ respectively.
Let's assume that operators $A$ and $B$ commute (in case either of them is unbounded it means that all the projections in their associated spectral measure commute). I wonder whether it is possible to define $g(A,B)$ for any $g: \mathbb{R}^2\to \mathbb{R}$ by $$g(A,B) = \int d \mu_A(\lambda_1)d\mu_B(\lambda_2) ~g(\lambda_1,\lambda_2) .$$
According to Reed & Simon vol. 1, Thm VII.12 the above statement is true for $g(\lambda_1,\lambda_2)=\exp(i t_1\lambda _1 + i t_2 \lambda_2 )$, where $t_1$, $t_2$ are arbitrary real parameters.
If the Borel function $f:\mathbb{R}\to \mathbb{R}$ is unbounded and real-valued then $f(A)$ is self-adjoint on the domain consisting of $\psi\in H$ for which $$ \int (\psi,d\mu_A(\lambda)\psi) ~|f(\lambda)|^2<\infty$$.
Is it true that for $g:\mathbb{R}^2\to \mathbb{R}$ unbounded and real-valued, $g(A,B)$ is self-adjoint on the domain consisting of $\psi\in H$ for which $$ \int (\psi,d\mu_A(\lambda_1)d\mu_B(\lambda_2)\psi) ~|g(\lambda_1,\lambda_2)|^2<\infty.$$
For example: if $A$ and $B$ commute (in a sense of spectral projections) then we can define self-adjoint operator $A+B$ with domain consisting of $\psi\in H$ for which $$ \int (\psi,d\mu_A(\lambda_1)d\mu_B(\lambda_2)\psi) ~(\lambda_1+\lambda_2)^2<\infty.$$ Am I right?