# Mathematical "inclusion" and "exclusion" of elements from a given set $A$?

If I have a set A, comprising of numbers from 1 to 10: $$A = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}$$. Let's say I want to make another set by "including" all even numbers:

$$\{2, 4, 6, 8, 10\}$$

Or I wanted to make a different set by "excluding" all odd numbers:

$$\{2, 4, 6, 8, 10\}$$

These sets are of course the same. So is it correct to say that inclusion/exclusion are synonymous when it comes to set theory, as they're just different ways of building a set?

This might sound trivial, but I have a reason for asking: I want to understand if inclusion and exclusion are "commutative" properties, i.e. it doesn't matter in which order you apply them.

For example, let's say I make an operation to "filter" my set, by including all even numbers as we did before, producing set B

$$B = \{2, 4, 6, 8, 10\}$$

And then a separate operation to "exclude" any numbers less than 6 from set B, resulting in set C:

$$C = \{6, 8, 10\}$$

What if I started with A and applied the operations the other way around? First remove all numbers less than 6:

$$B = \{6, 7, 8, 9, 10\}$$

Then filter B to "include" only even numbers:

$$C = \{6, 8, 10\}$$

It seems intuitively to me that the result will always be the same no matter which order you apply the operation. Is this true for all cases no matter the set, however? Is there a way to prove that applying "filters" to a set (I'm not sure of the proper term) will always be commutative?

So in summary, there are two questions here:

1. Are the notions of "inclusion" and "exclusion" really synonymous from the point of view of applying an operation to a set to produce a subset?
2. Will applying these operations to produce a subset of a set always be commutative, i.e. produce the same result?
• It looks lile you are taking repeated intersections of sets. Intersection is both associative and commutative. May 26 at 10:25
• @CrackedBauxite I've had a think about this. Is it intersection, or is it a set difference / relative complement? If I've got the set $\{1, 2, 3, 4, 5\}$ and I exclude all odd numbers, I've got a set of odd numbers $\{1, 3, 5\}$. It's my original set $\{1, 2, 3, 4, 5\} - \{1, 3, 5\} = \{2, 4\}$
– Lou
May 26 at 16:45
• But if I were to do "include all even numbers" from the set $\{1, 2, 3, 4, 5\}$, then I have a set of even numbers $\{2, 4\}$. $\{1, 2, 3, 4, 5\} \cap \{2, 4\} = {2, 4}$ I think - but please correct me if my logic is wrong
– Lou
May 26 at 16:46
• So I think "include" as an operation represents an intersection, but "exclude" represents a set difference?
– Lou
May 26 at 16:48
• Set differences are also intersections. $A\setminus B = A\cap B^c$, where $B^c$ is the complement of $B$. May 27 at 8:38

@KevinS offers an excellent answer from a logic point of view. Here's another that relies on the idea of a filter. That's a concept useful in programming (particularly in lisp). You pass the items in your set through a filter that lets some through and blocks others.

In this sense "inclusion" and "exclusion" are really different ways to describe the same result. You can specify what you keep or what you reject. "Keep (just) the odds" is the same as "reject (only) the evens".

If you have two filters each of which is described independently of the other and refers only to properties of the things you are filtering then you can filter in either order.

The independence matters. If you think that the wine must match the main course then your options will depend on whether you see the wine list or the menu first.

• You've hit upon my actual use case - I'm doing filtering in Python and trying to understand if "inclusion" and "exclusion" for my use case are order-sensitive, or commutative operations. You've all helped me understand that they are commutative and therefore order should not matter.
– Lou
May 26 at 10:52

This is perhaps easier to see in the math logic. When you apply conditions to a set, you get subsets that satisfy those conditions (possibly the emptyset if the conditions aren't met). In your example, define: $$A := \{n\in\mathbb{N}\text{ }|\text{ }1\leq n\leq 10\}.$$ Then $$B$$ and $$C$$ are had by adding conditionals in the set definition: $$B := \{n\in A\text{ }|\text{ }\exists k\in\mathbb{N}: n=2*k\}$$ and $$C:= \{n\in B\text{ }|\text{ }n\geq 6\}.$$ $$\implies C = \bigg\{n\in \mathbb{N}\text{ }\bigg|\text{ }(1\leq n\leq 10)\wedge(\exists k\in\mathbb{N}: (n=2*k))\wedge(n\geq 6)\bigg\}.$$ From this viewpoint, the reductions made were simply conjuctions (a logical operation). Conjunction is certainly commutative.

Also, the term "exclusion" is synonymous with set difference: $$X-Y:= X\cap Y^c,$$ whereas "inclusion" usually refers to an injective map: $$\iota: S\hookrightarrow X$$ which can be used as an identifier of a subset. I wouldn't say the two notions are synonymous.

• I'm a beginner in set theory, would you mind clarifying what you mean about an "injective map"? I understand the term set difference.
– Lou
May 26 at 14:21
• It seems as though the terms used might have multiple meanings as they apply to math and programming. An injection is a 1-1 function. The math notion I gave generalizes to categories (using equivalence classes of monomorphisms to identify sub-objects). This is not inherently programmable and is best used for theory. May 26 at 21:34

To your first question, consider using the set-builder notation to build a subset. That is, define $$B\subseteq A$$ such that $$B = \{a\in A : \Phi(a)\}$$, where $$\Phi$$ is the logical formula which dictates what how we pick the values of $$A$$.

Now say that $$A$$ is some collection of numbers, and $$\Phi$$ is the rule "include all even numbers". Then some other rule $$\Psi$$ which says "do not include all not even numbers" is completely logically equivalent to $$\Phi$$.

And this generalises nicely by considering that, if we impose a condition like "even number", any element of a set will satisify that condition, or not satisfy that condition. We cannot have an element which does neither.

The second question follows as others have pointed out, by writing the conditions as operations which are commutative.