Set Difference is not Associative

Theorem
For any three sets $$R, S, T$$:


 * $$\left({R \setminus S}\right) \setminus T \subseteq R \setminus \left({S \setminus T}\right)$$

where $$R \setminus S$$ etc. denotes set difference.

Thus it is clear that set difference is not associative.

The expression:
 * $$\left({R \setminus S}\right) \setminus T = R \setminus \left({S \setminus T}\right)$$

holds exactly when $$R \cap T = \varnothing$$.

Proof
We assume a universe $$\mathbb U$$ such that $$R, S, T \subseteq \mathbb U$$.

We have the identity Set Difference as Intersection with Complement:
 * $$R \setminus S = R \cap \overline S$$

where $$\overline S$$ is the set complement of $$S$$: $$\overline S = \mathbb U \setminus S$$.

Thus we can represent the two expressions as follows.

The first one is easy enough:

$$ $$

The second one is more involved:

$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$

As can be seen, this full expansion of the second expression can be expressed:
 * $$R \setminus \left({S \setminus T}\right) = \left({\left({R \setminus S}\right) \setminus T}\right) \cup \left({R \cap T}\right)$$

Hence the first result, from Subset of Union.

It directly follows from Intersection with Null that:
 * $$R \setminus \left({S \setminus T}\right) = \left({R \setminus S}\right) \setminus T \iff R \cap T = \varnothing$$