Nested Quantifiers

Nested quantifiers

By nested, we mean that a quantifier is in the scope of another quantifier. If we focus only on two quantifiers, there are four nesting possibilities. Assume an arbitrary domain DD, with nn elements, and a predicate PP, with two variables.

We know that,

xyP(x,y)yxP(x,y).\forall x \forall y P(x,y) \equiv \forall y \forall x P(x,y).

Any such statement asserts that for every pair (x,y)(x,y) picked from D,P(x,y)D, P(x,y) is true.

We also know that,

xyP(x,y)yxP(x,y).\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y).

Every such statement asserts that we can pick at least one pair (x,y)(x,y) from DD, such that P(x,y)P(x,y) is true.

Now, let’s look at the remaining two cases. Let’s discuss them one by one.

For all xx there is a yy

Let’s discuss the case when existential quantifier comes in the scope of universal quantifier, that is,

xyP(x,y).\forall x \exists y P(x,y).

In such a case, the quantified statement asserts that for every element xx of the domain, there is at least one element yy (in the domain), such that P(x,y)P(x,y) is true. Let’s look at a few example scenarios with such statements.

Examples


Let’s take the domain as the set of all people alive and the following predicate.

  • L(x,y)L(x,y): xx loves yy.

Now, let’s quantify this predicate as follows:

  • xyL(x,y)\forall x \exists y L(x,y): Every person loves at least one person.

We can write it briefly as follows:

  • xyL(x,y)\forall x \exists y L(x,y): Everybody loves someone.

Again, take the domain as the set of all people alive and consider the following predicate:

  • M(y,x)M(y,x): yy is mother of xx.

After quantification, we have,

  • xyM(y,x)\forall x \exists y M(y,x): Everybody has a mother.

Consider the set of integers as the domain and define the following predicate:

  • I(x,y)I(x,y): x+y=0.x+y=0.

Now let’s quantify it as follows:

  • xyI(x,y)\forall x \exists y I(x,y): Every integer has an additive inverse.

Again, consider the set of integers as the domain and define the following predicate:

  • S(x,y)S(x,y): y=x2.y=x^2.

Now, let’s quantify it as follows:

  • xyS(x,y)\forall x \exists y S(x,y): Every integer has a square.

There is an xx, such that, for all yy

Now, let’s discuss the case when a universal quantifier comes in the scope of an existential quantifier, that is,

xyP(x,y).\exists x \forall y P(x,y).

In such a case, the quantified statement asserts that there is at least one member xx of the domain, such that for every member yy of the domain, P(x,y)P(x,y) is affirmative. Let’s look at some examples of such quantification.

Examples

Consider the set of integers as the domain and define the following predicate:

  • M(x,y)M(x,y): x×y=y.x\times y=y.

Let’s quantify MM as follows:

  • xyM(x,y)\exists x \forall y M(x,y): There is an integer xx if multiplied with any integer yy, the result is yy.

We can write it briefly as follows:

  • xyM(x,y)\exists x \forall y M(x,y): Integers have a multiplicative identity.

We are familiar that the multiplicative identity is one.


Let’s take the domain as the set of all people alive and define the following predicate:

  • L(x,y)L(x,y): xx loves yy.

Now, let’s quantify this predicate as follows:

  • xyL(x,y)\exists x \forall y L(x,y): There is at least one person who loves everyone.

We can write it succinctly as follows:

  • xyL(x,y)\exists x \forall y L(x,y): Someone loves everybody.

Again, take the domain as the set of all people alive and define the following predicate:

  • F(x,y)F(x,y): xx is wealthier than yy:

Now, quantify this predicate as follows:

  • xyF(x,y)\exists x \forall y F(x,y): Someone is wealthier than everyone.

Quiz

Test your understanding of nested quantifiers.

Question

Is the statement xyP(x,y)\exists x \forall y P(x,y) equivalent to the statement xyP(x,y)\forall x \exists y P(x,y)?

Show Answer

Multiple domains

Until now, we’ve seen only the scenarios where we took more than one variable from a single domain. There are many scenarios where each variable in the predicate has a different domain. Let’s look at a few examples to elaborate on this point further.

Examples

Here are a few examples.


Let’s consider the set of people and the set of tourist places.

Let’s define a predicate as follows:

  • P(x,y)P(x,y): xx is planning to visit yy this summer.

Notice that xx is from people and yy is from tourist places.

Let’s quantify this predicate as follows.

  • xyP(x,y)\forall x \exists y P(x,y): Everybody is planning to visit some tourist place this summer.

Now, let’s quantify the same predicate differently.

  • yxP(x,y)\exists y \forall x P(x,y): There is some tourist place that everybody is planning to visit this summer.

  • xyP(x,y)\forall x \forall y P(x,y): Everybody is planning to visit every tourist place this summer.

  • xyP(x,y)\exists x \exists y P(x,y): Someone is planning to visit some tourist place this summer.

Quantifiers as loops

Let’s assume a predicate PP and domain DD. We can think of a universal quantifier as looping through DD and verifying that PP is true for every member. Similarly, we can think about existential quantifiers as looping through DD and confirming that PP is true for at least one member of it.

Let’s define two sets as follows.

  • A={A = \{ Ahmad, John, Smith, Beth, Sara}\}

  • B={B = \{Apple, Mango, Grapes, Melon, Banana}\}

Now, assume that xAx\in A and yBy\in B. Let’s define a predicate.

  • P(x,y)P(x,y): xx likes to eat y.

Run the following code to see when each of xyP(x,y),xyP(x,y),xyP(x,y),\forall x\forall y P(x,y), \exists x\exists y P(x,y), \forall x \exists y P(x,y), and xyP(x,y)\exists x \forall y P(x,y) is true. We can change the variables A and B by adding or subtracting a few elements to play with this code.

Press + to interact
A = ["Ahmad", "John", "Smith", "Beth", "Sara"]
B = ["Apple", "Mango", "Grapes", "Mellon", "Banana"]
s=""
print("\u2200x\u2200yP(x,y) is true if:")
for x in A:
for y in B:
s+="P("+x+","+y+")\u2227"
s+="\n"
print(s[:-2]+" is TRUE.")
s=""
print("\n\u2203x\u2203yP(x,y) is true if:")
for x in A:
for y in B:
s+="P("+x+","+y+")\u2228"
s+="\n"
print(s[:-2]+" is TRUE.")
s=""
print("\n\u2200x\u2203yP(x,y) is true if:")
for x in A:
s+="("
for y in B:
s+="P("+x+","+y+")\u2228"
s=s[:-1]+")\u2227\n"
print(s[:-2]+" is TRUE.")
s=""
print("\n\u2203x\u2200yP(x,y) is true if:")
for x in A:
s+="("
for y in B:
s+="P("+x+","+y+")\u2227"
s=s[:-1]+")\u2228\n"
print(s[:-2]+" is TRUE.")

Explanation

  • Lines 1–2: We specify the domain for the variables x, and y.

  • Lines 3–9: We loop through AA and BB and generate the proposition that needs to be true to prove xyP(x,y)\forall x\forall y P(x,y) is true.

  • Lines 10–16: We loop through AA and BB and generate the proposition that needs to be true to prove xyP(x,y)\exists x\exists y P(x,y) is true.

  • Lines 17–24: We loop through AA and BB and generate the proposition that needs to be true to prove xyP(x,y)\forall x \exists y P(x,y) is true.

  • Lines 25–32: We loop through AA and BB and generate the proposition that needs to be true to prove xyP(x,y)\exists x \forall y P(x,y) is true.