Nested Quantifiers

Lecture 9, DSCI 220, 2026W1

Announcements

  • EX1 is marked. EX2 is Thu 10/8 through Sun 10/11.
  • Practice problems for EX2 go up Wednesday night.
  • No class Wednesday — National Day for Truth and Reconciliation.
  • HW2 is out, due Sun Oct 4.

Warm-up: Introduce yourself to a classmate you haven’t met yet. Ask them one question about their life, and tell them one thing about yours.

Code Patterns

Nested Quantifiers

More Than One

Friday we bound one variable. Nothing stops us binding two.


     \(\forall x\, \forall y\ \text{Knows}(x,y)\)


     \(\forall x\, \exists y\ \text{Knows}(x,y)\)


     \(\exists x\, \forall y\ \text{Knows}(x,y)\)


Say each one out loud. ______________________________

Every Lock Has a Key

\(K(k, l)\): key \(k\) opens lock \(l\).

Says what, in English?
\(\forall l\, \exists k\ K(k,l)\)
\(\exists k\, \forall l\ K(k,l)\)


Which one would a locksmith charge you more for? ____________

Does Order Matter?

Swap Same?
\(\forall x\, \forall y\ P(x,y)\)   vs   \(\forall y\, \forall x\ P(x,y)\)
\(\exists x\, \exists y\ P(x,y)\)   vs   \(\exists y\, \exists x\ P(x,y)\)
\(\forall x\, \exists y\ P(x,y)\)   vs   \(\exists y\, \forall x\ P(x,y)\)


So the rule is: __________________________________

One Picture

Rows are \(x\), columns are \(y\). A mark means \(P(x,y)\) holds.

\(y_1\) \(y_2\) \(y_3\)
\(x_1\) ✓
\(x_2\) ✓
\(x_3\) ✓


Every row has a mark, so _____________________

No column is all marks, so _____________________

Your Turn

In pairs, work the worksheet.


Page 3 is the grid you just saw — except now you place the hearts.

Words and Ideas

Nested quantifiers

Order of quantifiers

\(\forall\exists\) versus \(\exists\forall\)