Boolean Logic: Predicate Logic

    Boolean Logic: Predicate Logic

      It’s physics-puzzle video-game weekend in Shmoopville and you decide to bust out your classic copy of Thermodynamics: The Battle Against Entropy and battle the universe's inevitable descent into chaos once again. While exploring the bowels of the universe, you find a strange, slightly creepy series of symbols. Could this be a message from the Orderlies, a race of aliens dedicated to bringing order and peace to the universe?

      One thing's for sure: you need to figure out what these symbols mean. It says:

      ∀ (Things): fall(apart)

      Who knows what it could mean?

      You will. After finding out about predicate logic.

      Statements like

      • x is greater than or equal to 7
      • all cake is a lie
      • things fall apart

      have truth values that change depending on the circumstances. X might equal 5 in one equation and 15 in another, you could be in a bakery rather than Aperture Science's Enrichment Center, or you could take a wormhole to a universe where entropy isn't a thing. These aren't propositions though, so they can't fall under the category of propositional logic.

      Instead, we're going to use something called predicate logic, to help pin down when such statements are True and when they might be False. (Source)

      Predicate logic is the formal logician’s bread and butter (or Sriracha and literally any other food, if that’s more your thing). Predication identifies a property and tries to connect that property to all, some, or none of a group of things. It also involves some logical shorthand to keep logicians from developing carpal tunnel.

      Let’s say that we encounter some entropy zombies in our struggle to impose order on a chaotic universe. Entropy zombies—like the rest of the universe—don't care about our noble cause. They just want to nom on our brains and destroy things. (Most zombies, anyway.) We want to say that all zombies are dangerous.

      To translate that idea into logic-ese, we'd say, "For all things (whether that thing is a zombie or not), being a zombie implies that thing is also dangerous." The two traits of "being a zombie" and "being dangerous" go hand in hand. Logicians would even go so far as to say that "zombiness" implies "dangerousness" and would use that implicational ⟶ connective. We can go even more symbolic, though.

      Let’s pretend for the moment that "zombie" and "dangerous" are math-like functions that we can apply to anything, like a spell. To make a zombie cat, we would just say zombie(cat). (R.I.P. Pickles.) To make a saber-toothed tiger or other dangerous cat, we could say dangerous(cat).

      Since our magic works on anything, we could also say zombie(cat) and dangerous(cat). (Pickles, no!) Now we just need to connect the idea of zombies to that of danger: zombies are scary after all. To say that being a zombie implies being scary, we can use the implication sign:, zombie(cat)dangerous(cat).

      But wait, there's more!

      When fighting against entropy, we need to be as orderly as possible. To do that, we need to know what groups of objects or things we're talking about, even if that group is everything. Most symbolic logic statements, or predicates, like this begin with either

      • ∀(x)—a.k.a. "For all x."
      • ∃(x)—a.k.a. "There exists an x."

      To make the statement apply to all the cats in the universe, we need to add an ∀(x) at the beginning of the statement. At the end of the day, it's going to look like this:

      ∀(cat): zombie(cat)dangerous(cat)

      Translated out of logic-ese, we get the statement, "For all cats: if a cat is a zombie, then that cat is dangerous". Pretty long and complex, but much simpler to write using predicate logic.

      Let's say you're at the end stages of your video game and the zombie hordes have been largely vanquished. Everyone in this universe is either a zombie or a human—but not both (exclusive or, anyone?). Once you finally defeat the space zombie cat boss, ~zombie(x) is the same as human(x). Every being in the game-verse is now a human, so you can say that ∀(person): human(person). Roll end credits; we're good.

      But couldn’t you also say that nobody was a zombie?

      Since someone (or something) is represented by the ∃ symbol, saying that it doesn't exist (~∃) means nobody (or nothing) is that thing. Saying nobody is a zombie in symbols would look like ~∃(person): ~human(person), which means, "There doesn't exist a person who is not a human."

      Wordy, but it gets the job done.

      Okay, but what if you failed the final boss battle and entropy zombies rule the universe. You could say ∀(person): ~human(person)) or nobody is a human (~∃(person): human(person)).

      Strangely enough, if you put that not (~) symbol in front of ∀(person): human(person), you aren’t saying that nobody passed. You're just weakening your argument to say that not everyone's human. It's exactly the same as saying someone isn't a human: ∃(person): ~human(person). The two are exactly equal, making them logically equivalent.

      If you put a ~ symbol in front of ∃(person): human(person), you're saying that there doesn't exist someone who is human. That's the same as saying everyone's a zombie: ∀(person): ~human(person).

      Yeesh. Maybe this game isn't for us.

      Let's get a little bit more complicated and add in a connector from the Logic Table section. If we wanted to say that some zombie cat is hungry for brains, we could do it using the ∃(x) symbol: ∃(cat): zombie(cat)hungryforbrains(cat). This translates formally to "There exists a cat such that cat is a zombie and cat is hungry for brains."

      Maybe the zombie cats want to spread some propaganda through the universe and make a sign that says: ∀(person): zombie(person) ∧ hungryforbrains(person). This means that everyone (all humans) are

      • zombies.
      • hungry for brains.

      You might want to start running. Or…shambling. You are a zombie, after all.