Let $\Omega$ be a standard atomless probability space, we can assume $\Omega=(0,1)$ with Lebesgue measure. A bijection $f:\Omega/A\_1\to\Omega/A\_2$ is almost automorphism, if $P(A\_1)=P(A\_2)=0$, $f(A)$ is measurable if and only if $A$ is, and $P(f(A))=P(A)$ in this case. An almost automorphism preserves a (real-valued) random variable (r.v.) $X$ if $X(\omega)=X(f(\omega))$ for almost all $\omega$. 


The question is: Assume that every almost automorphism preserving $Y$ preserves also $X$. Does this imply that $X$ is $Y$-measurable, that is $X=g(Y)$ a.s. for some $g:R \to R$? 



Random variables invariant under almost automorphisms.
Fix for convenience $\Omega = [0,1)$ with Lebesgue measure $\mu$. We exhibit a family of continuum-many Borel functions $X\_\alpha \colon [0,1) \to \mathbb{R}$, indexed by $\alpha \in (0, 1/2)$, such that


* Each $X\_\alpha$ has only trivial almost automorphisms, in the sense that each almost automorphism $f$ preserving $X\_\alpha$ has $\mu$-null support (i.e., the set $\{r : r \neq f(r)\}$ is $\mu$-null).
* When $\alpha \neq \beta$ we have that $X\_\alpha$ is not in your sense $X\_\beta$-measurable.


In particular we get a negative answer to the question.


For each $\alpha \in (0,1/2)$ put $I\_\alpha = [0,\alpha)$ and $J\_\alpha = [0,1) \setminus I\_\alpha = [\alpha, 1)$. Let $i\_\alpha \colon [0,1) \to [0,1)$ be the obvious fixed-point-free involution flipping $I\_\alpha$ and $J\_\alpha$. Note that since $\alpha < 1/2$ this involution distorts $\mu$ in the following sense: any $\mu$-positive Borel set $A$ contains a $\mu$-positive Borel set $A' \subseteq A$ such that $\mu(A') \neq \mu(i\_\alpha[A'])$. In particular, no restriction of $i\_\alpha$ to a set of $\mu$-positive measure can be a $\mu$-preserving map.


Now define $X\_\alpha$ by 


* $X\_\alpha(r) = r$ if $r \in I\_\alpha$,
* $X\_\alpha(r) = i\_\alpha(r)$ if $r \in J\_\alpha $.


Note that $X\_\alpha(r) = X\_\alpha(s)$ iff $r = s$ or $r = i\_\alpha(s)$. It follows that any almost automorphism preserving $X\_\alpha$ is almost everywhere some restriction of $i\_\alpha$, but by the previous paragraph it must in fact be almost everywhere the identity. So each $X\_\alpha$ has only trivial almost automorphisms.


Finally, suppose that $\alpha < \beta$ in $(0,1/2)$. Put $R = [\alpha, \beta)$. Note that for each $r \in R \subseteq J\_\alpha$ we have $i\_\beta(r) \in J\_\alpha$ and in particular $X\_\alpha(r) \neq X\_\alpha(i\_\beta(r))$. Of course by construction we have $X\_\beta(r) = X\_\beta(i\_\beta(r))$. So if $g \colon \mathbb{R} \to \mathbb{R}$ is any function, for each $r\in R$ we must have at least one of $g(X\_\beta(r)) \neq X\_\alpha(r)$ or $g(X\_\beta(i\_\beta(r)) \neq X\_\alpha(i\_\beta(r))$ and in particular $g \circ X\_\beta$ does not agree $\mu$-a.e. with $X\_\alpha$. In other words, $X\_\alpha$ is not $X\_\beta$-measurable.


A similar argument using $i\_\alpha$ shows that $X\_\beta$ is not $X\_\alpha$-measurable.


