Boolean Logic: Connectives and Set Theory
Boolean Logic: Connectives and Set Theory
We have a little confession to make: we have a weakness. Okay, we have many weaknesses, but one big one is our love for outrageous ice cream flavors. They can't be normal flavors like chocolate or vanilla (yawn). Instead, give us
- garlic.
- oyster.
- soy sauce.
Talk about a quality sundae. If we were to take a set of all the ice cream flavors, we'd have…a really big group of non-repeating flavors. It'd look something like this:
{chocolate, vanilla, strawberry, garlic, oyster, soy sauce, cookie dough…}
If we're dealing exclusively in ice cream flavors, we can call this set our universe of flavors. Every time we make a statement about flavors, all the flavors we talk about are going to come from this list.
But Shmoop's very picky about the flavors we like. So we'll have to take a subset of those flavors. That's going to look something like this:
{garlic, oyster, soy sauce, steak, wasabi, red curry}
Mmm, red curry ice cream.
Every ice cream flavor in our universe can either be a part of our subset or…not a part of our subset. The disgusting ice cream flavors not in our subset are going to be part of a set called the complement. Together, those two sets are going to have every flavor in the ice cream flavor universe, but you won't be able to find a flavor in both of them. Each flavor can either be in a subset or that subset's complement—not both.
Venn Diagrams
You can represent all kinds of different subsets in a Venn Diagram. Venn Diagrams are a girl's best friend. The jury's still out about whether they're also a guy's best friend—or a non-binary individual's.
Venn Diagrams are basically the visual equivalent of a set. Let’s have two sets of things, X and Y.
Outside of X, there are the things not in X (like the ice cream flavors not in our list of favorites).
To mark out the complement of X, we could use either ~X or x̄. This time, though, we'll use x̄. (It's also known as X's negation, but we won't get into that just yet.)
Sometimes there are shades of gray in our ice cream universe. For instance, what if our best friend Jebediah Sparks likes soy sauce flavored ice cream and vanilla? We need more than just X and its complement.
Luckily, we can set Jeb up with his own set Y. Now flavors can belong to more than one set. If they do, they're going to belong in the intersection of X and Y, which is written like this: X ∩ Y.
We both love soy sauce ice cream, so that's going to end up in that middle section—the intersection—of this Venn Diagram because it belongs in both sets.
We can also talk about everything that goes into set X or Y, or both. The union of the two sets (X ∪ Y) is going to look like this:
The union of our favorite ice cream flavors is going to include
- all Shmoop's favorites.
- all of Jeb's favorites.
- the intersection of Shmoop and Jeb's favorites.
We can also talk about all the flavors that Shmoop and Jeb love except for the ones they both love. Complicated? Yes. Important? Also yes.
The set theory definition's going to call it something more complicated. It's going to say that this set's the union of everything in X but not Y and in Y but not X. Actually, now that we look at it, it isn't any more complicated than what we said before. Huh.
Anywho, here's the Venn Diagram:
It's going to be written like this:
X ∩ ~Y ∪ Y ∩ ~X
And one more thing before we go. Say Jeb has a little sister named Dorcas. Dorcas wants to be just like Jeb, so she picked all her favorite flavors out of the ones he loves. Dorcas's favorite flavors are also all of Jeb's—but Jeb has some favorite flavors that Dorcas—despite her idolization of Jeb—can't stand. So Dorcas's set, D, is a subset of Jeb's set. That's going to look something like this:
And that's it. That's Set Theory.