Nested Quantifiers
Learn about using nested quantifiers in a single statement.
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 , with elements, and a predicate , with two variables.
We know that,
Any such statement asserts that for every pair picked from is true.
We also know that,
Every such statement asserts that we can pick at least one pair from , such that is true.
Now, let’s look at the remaining two cases. Let’s discuss them one by one.
For all there is a
Let’s discuss the case when existential quantifier comes in the scope of universal quantifier, that is,
In such a case, the quantified statement asserts that for every element of the domain, there is at least one element (in the domain), such that 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.
- : loves .
Now, let’s quantify this predicate as follows:
- : Every person loves at least one person.
We can write it briefly as follows:
- : Everybody loves someone.
Again, take the domain as the set of all people alive and consider the following predicate:
- : is mother of .
After quantification, we have,
- : Everybody has a mother.
Consider the set of integers as the domain and define the following predicate:
- :
Now let’s quantify it as follows:
- : Every integer has an additive inverse.
Again, consider the set of integers as the domain and define the following predicate:
- :
Now, let’s quantify it as follows:
- : Every integer has a square.
There is an , such that, for all
Now, let’s discuss the case when a universal quantifier comes in the scope of an existential quantifier, that is,
In such a case, the quantified statement asserts that there is at least one member of the domain, such that for every member of the domain, 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:
- :
Let’s quantify as follows:
- : There is an integer if multiplied with any integer , the result is .
We can write it briefly as follows:
- : 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:
- : loves .
Now, let’s quantify this predicate as follows:
- : There is at least one person who loves everyone.
We can write it succinctly as follows:
- : Someone loves everybody.
Again, take the domain as the set of all people alive and define the following predicate:
- : is wealthier than :
Now, quantify this predicate as follows:
- : Someone is wealthier than everyone.
Quiz
Test your understanding of nested quantifiers.
Is the statement equivalent to the statement ?
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:
- : is planning to visit this summer.
Notice that is from people and is from tourist places.
Let’s quantify this predicate as follows.
- : Everybody is planning to visit some tourist place this summer.
Now, let’s quantify the same predicate differently.
-
: There is some tourist place that everybody is planning to visit this summer.
-
: Everybody is planning to visit every tourist place this summer.
-
: Someone is planning to visit some tourist place this summer.
Quantifiers as loops
Let’s assume a predicate and domain . We can think of a universal quantifier as looping through and verifying that is true for every member. Similarly, we can think about existential quantifiers as looping through and confirming that is true for at least one member of it.
Let’s define two sets as follows.
-
Ahmad, John, Smith, Beth, Sara
-
Apple, Mango, Grapes, Melon, Banana
Now, assume that and . Let’s define a predicate.
- : likes to eat y.
Run the following code to see when each of and is true. We can change the variables A
and B
by adding or subtracting a few elements to play with this code.
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
, andy
. -
Lines 3–9: We loop through and and generate the proposition that needs to be true to prove is true.
-
Lines 10–16: We loop through and and generate the proposition that needs to be true to prove is true.
-
Lines 17–24: We loop through and and generate the proposition that needs to be true to prove is true.
-
Lines 25–32: We loop through and and generate the proposition that needs to be true to prove is true.