Solution (source code)

= Solution

Let $A$ and $B$ be the finite <sets> of objects satisfying the two properties. The <rule of sum> says that mutually exclusive alternatives have additive counts: if $A\cap B=\varnothing$, then $|A\cup B|=|A|+|B|$. Without disjointness, the corresponding <inclusion-exclusion principle> is
$$
|A\cup B|=|A|+|B|-|A\cap B|.
$$
The <rule of subtraction> counts objects satisfying the first property but not the second:
$$
\boxed{|A\setminus B|=|A|-|A\cap B|.}
$$
In particular, if the objects with the second property form a <subset> of those with the first, the count is $|A|-|B|$. These conditions prevent either double counting an overlap or subtracting objects that were not counted initially.