Does $Z=X+Y$ imply $Z-Y=X$ when $X,Y,Z$ are random variables? I was recently working through someone else's proof involving Gaussian processes $\{X_t\}_{t\in\mathbb{N}}$ and $\{\epsilon_t\}_{t\in\mathbb{N}}$, where $\epsilon_t$ was iid Gaussian noise and $X_t$ was a random walk:
$$
X_t = X_{t-1} + \epsilon_t
$$
and another processes $\{Z_t\}_{t\in\mathbb{N}}$ was defined as
$$
Z_t = X_t + \phi_t
$$
with $\phi_t$ another source of iid Gaussian noise.  In their proof, they started with the first equation above and made the substitution $X_{t-1} = Z_{t-1} - \phi_{t-1}$ to get
$$
\begin{align}
X_t &= X_{t-1} + \epsilon_t \\
X_t &= (Z_{t-1} - \phi_{t-1}) + \epsilon_t &&(*)
\end{align}
$$
And that seems perfectly fine.  But I have what feels like a very stupid question.  Was that substitution valid?  If not, what assumptions make it valid?

I ask because they came to an incorrect result, which is why I was working through the proof in the first place, and I could find no mistake anywhere.  So now I'm testing even my most basic assumptions.  I've tried to figure this out on my own, but I'm just not sure.
The following example is what makes me wonder if the substitution was indeed valid, but I suspect I'm making a basic mistake.  Let $X$ and $Y$ be r.v. with
$$
X=
\begin{cases}
-1, p=0.1\\
1, p=0.9
\end{cases}
$$
$$
Y=
\begin{cases}
-1, p=0.5\\
1, p=0.5
\end{cases}
$$
Then
$$
Z=X+Y = 
\begin{cases}
-2, p=0.05\\
0, p=.5 \\
2, p=0.45
\end{cases}
$$
Perhaps I'm missing something, but it appears the r.v. $Z-Y$ can take values in  $\{\pm 1, \pm 3\}$.  So $Z-Y \neq X$.  And we can conclude that $Z=X+Y$ does not necessarily imply $X=Z-Y$, and we cannot make the substitution in $(*)$.  ...But that feels very incorrect, and I'd really appreciate having my mistakes pointed out.
 A: I'm not sure this is a full answer (because I'm a bit confused too), but your question seems to hinge on whether or not the random variable $$ X + Y - Y$$ is the same as the random variable $X$, (i.e. "has the same distribution as").
And I think this comes down to some ambiguity with the way we write random variables. If you use the same letter twice, we can't tell if you mean the identical sample drawn from that same variable, or a new instance from a different variable with the same distribution.
In the first part of your question, when they wrote $X_{t-1} = Z_{t-1} - \phi_{t-1}$, it looks like the intention was that $\phi_{t-1}$ meant the identical $\phi_{t-1}$ used to define $Z_{t-1}$, so the cancellation was valid. But in the second half, where you wrote $Z-Y$,  you were "re-instantiating" $Y$, i.e. getting values from a different, though identically distributed, instance of $Y$, and so $Y - Y \ne 0$.
(If you program in C++, there is an analogy with assigning a pointer vs. calling a copy constructor, but it's not worth get getting into if those terms aren't immediately meaningful to you.)
A: This answer may give rise to criticism due to it's technical incorrectness, nevertheless I think it is clearly more correct then the current only answer and I am happy to remove it when there is a better answer.
When you work with probabilities, you typically define a probability space $(\Omega, \Sigma, \mathbb P)$ where $\Omega$ represents the the universe, $\Sigma$ is a set containing subsets of $\Omega$ (technically it is supposed to be a $\sigma$-algebra) and $\mathbb P$ is a mapping from $\Sigma$ to $[0,1]$ that satisfies several properties.
The confusion here is that a random variable is defined as a mapping from $\Omega$ to some set (again some more technicalities missing here) and not in terms of it's probability distribution, indeed there is no dependence on $\mathbb P$. So when we deal with real random variable $X$ and $Y$ we mean to have mappings $\omega\to X(\omega)$ and $\omega\to Y(\omega)$, now the sum of those is also a mapping from $\Omega$ to $\mathbb R$ such that $\omega\to X(\omega)+Y(\omega)$. Subtracting $Y$ is again a mapping defined by $\omega\to X(\omega)+Y(\omega)-Y(\omega)=X(\omega)$ so we have that $X+Y-Y=X$, and all of this is independent of the probability distribution (that are functions of $\mathbb P$).
I hope this clarifies a bit, I am aware of some of the missing things. I would suggest reading the Wikipedia page of random variables and probability spaces to get the clear (and less arguable) definition, this may take a bit of time though.
