Find a course

Module 3: Categorical and Predicate LogicLesson 8 of 1313 min

Quantifiers and Predicate Logic

Write "all" and "some" with ∀ and ∃, negate quantified statements correctly, and catch ambiguity caused by the order of quantifiers.

Step 1 of 12Learn

Beyond Aristotle

Try this argument: "Everyone loves someone. So someone is loved by everyone." Most people sense it's wrong, but Aristotle's logic can't diagnose it, because it involves relations ("loves") and more than one "all"/"some" in a sentence. In 1879 the German mathematician Gottlob Frege created a far more powerful system, now called predicate logic (or first-order logic), and it remains the standard language of mathematics and computer science.

Predicate logic breaks statements into:

  • Predicates, written with capital letters: Cx means "x is a cat," Lxy means "x loves y."
  • Variables like x and y, standing for objects.
  • Quantifiers: ∀x, "for every x," and ∃x, "there exists an x" (at least one).

The A and I statements become:

  • All cats are mammals: ∀x (Cx → Mx). For anything at all, if it's a cat, it's a mammal.
  • Some cats are black: ∃x (Cx ∧ Bx). There's at least one thing that's a cat and is black.

Notice the pattern: ∀ goes with → and ∃ goes with ∧. Mixing them up is the number one beginner error. ∀x (Cx ∧ Mx) would say everything in the universe is a cat and a mammal, and ∃x (Cx → Mx) is true as soon as one thing isn't a cat, which says almost nothing.

Step 2 of 12Practice · Match the pairs

Let Sx = "x is a student" and Px = "x passed." Match each sentence to its symbolization.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. All students passed.
  2. Some students passed.
  3. No students passed.
  4. Some students did not pass.

Step 3 of 12Flashcards

Reading predicate logic

Tap a card to flip it.

Step 4 of 12Learn

Negating quantifiers

Negations of quantified statements follow two rules that mirror De Morgan's laws:

  • ¬∀x Fx is equivalent to ∃x ¬Fx. "Not everything is F" = "something isn't F."
  • ¬∃x Fx is equivalent to ∀x ¬Fx. "Nothing is F" = "everything is not F."

To push a negation through a quantifier, flip the quantifier and negate what's inside. For "Not all students passed": ¬∀x (Sx → Px) becomes ∃x ¬(Sx → Px), which simplifies to ∃x (Sx ∧ ¬Px): some student didn't pass. That matches the O statement from the last lesson.

English negation of "all" is notoriously slippery. "All that glitters is not gold" literally says nothing glittering is gold, but it means "not all that glitters is gold." "All the students didn't pass" could mean none passed or not all passed. When precision matters, rewrite it: "None of the students passed" or "Not every student passed."

In programming this is the difference between Python's all() and any(): not all(x > 0 for x in data) is the same as any(x <= 0 for x in data). A program that checks "every item is valid" fails when you find a single invalid one; a program that checks "some item is valid" succeeds as soon as you find one. Counterexamples refute universal claims, and examples prove existential ones.

Step 5 of 12Compare

Pushing a negation through a quantifier

AspectNot all…Not any…
Symbol¬∀x Fx¬∃x Fx
Becomes∃x ¬Fx∀x ¬Fx
In wordsSomething is not FEverything is not F
ExampleNot all students passed = some student failedNo one cheated = everyone did not cheat

Step 6 of 12Practice · Choose one

What is the correct negation of "Every flight today was delayed"?

Step 7 of 12Practice · Fill in the blanks

Fill in the blanks

To negate "There is a prime number that is even," write: every prime number is . Negating ∃ produces the quantifier .

Step 8 of 12Learn

Order matters

When a sentence has two quantifiers, their order changes the meaning. Let Lxy mean "x loves y."

  • ∀x ∃y Lxy: for every person x, there's some y whom x loves. Everyone loves someone (maybe different people).
  • ∃y ∀x Lxy: there's some y such that every x loves y. There's one person everyone loves.

The second implies the first, but not the other way around. The opening argument, "Everyone loves someone, so someone is loved by everyone," swaps the order and is invalid. Counterexample: in a group of three, Ana loves Ben, Ben loves Cara, Cara loves Ana. Everyone loves someone, but no single person is loved by all.

This quantifier shift fallacy shows up in serious arguments. "Every event has a cause, so there's one cause of every event" makes the same move. So does "Every student has a teacher they like, so there's a teacher every student likes." In math, the difference between "for every ε there's a δ" and "there's a δ for every ε" is the difference between continuity and a much stronger property.

English is often ambiguous about this. "A nurse checks on every patient" might mean one nurse checks them all, or each patient gets checked by some nurse. Logic forces the choice.

Step 9 of 12Diagram

Everyone loves someone…

The counterexample from the text. Tap a person.

Everyone loves someone…Cycle diagram: Ana → Ben → Cara.loves →AnaBenCara

Tap a shape with to see more.

∀x ∃y Lxy is true here (each person loves someone), but ∃y ∀x Lxy is false (no one is loved by all three).
Ana

Ana loves Ben, and is loved only by Cara.

Ben

Ben loves Cara, and is loved only by Ana.

Cara

Cara loves Ana, and is loved only by Ben.

Step 10 of 12Note

Step 11 of 12Practice · What would you do?

What would you do?

A manager says: "Every project on our team has someone responsible for it. So there's someone on our team responsible for every project." Is the reasoning valid?

Step 12 of 12Practice · True or false

∃x ∀y Lxy ("someone loves everyone") logically implies ∀y ∃x Lxy ("everyone is loved by someone").