Solution (source code)

= Solution

By <De Morgan's laws>, taking a <set difference> from a <union> requires exclusion from both <sets>, while taking a <set difference> from an <intersection> requires exclusion from at least one:
$$
\boxed{A\setminus(B\cup C)=(A\setminus B)\cap(A\setminus C),\qquad A\setminus(B\cap C)=(A\setminus B)\cup(A\setminus C).}
$$
For example, $x$ belongs to the first left-hand side precisely when $x\in A$, $x\notin B$ and $x\notin C$; these are exactly the membership conditions on the first right-hand side. For the second identity, replace the two exclusions by their <logical disjunction>.