Given a Borel function $f:\mathbb{R}\rightarrow\mathbb{R}\cup\{\infty\}$, functional calculus allows to calculate $F(x)$ for any unbounded selfadjoint operator $x$ on a Hilbert space $\mathcal{H}$, via $$F(x)=\int_{\mathbb{R}}f(\lambda)E(\lambda),$$ where $E(\lambda)$ is a spectral measure of $x$.

Question: given a function $F$ that maps unbounded selfadjoint operators to unbounded selfadjoint operators, what are the sufficient conditions to have an inverse of this calculus (i.e., to have a well-defined unique $f$, determined by $F$), and what is the specific formula that would generate $f$ from $F$?

More specifically:

- I am mostly concerned with a special case of the above question, with $F:E_1(\mathcal{N},\tau)^{\mathrm{sa}}\rightarrow E_2(\mathcal{N},\tau)^{\mathrm{sa}}$, where $E_1(\mathcal{N},\tau)^{\mathrm{sa}}$ and $E_2(\mathcal{N},\tau)^{\mathrm{sa}}$ are self-adjoint parts of two rearrangement invariant spaces over a semifinite von Neumann algebra $\mathcal{N}$ (acting on $\mathcal{H}$) with a faithful normal semifinite trace $\tau$. In this case $F$ maps within the selfadjoint part of a $*$-algebra of Nelson $\tau$-measurable operators affiliated with $\mathcal{N}$, so all unbounded operators in domain and codomain of $F$ are densely defined and closed;
- Is the heuristic formula $f(\lambda)=\sup_{\xi\in\mathcal{H}}\langle\xi,F(x)E(\lambda)\xi\rangle_{\mathcal{H}}$ correct? And, if (yes or no), then why?