Discrete Structures: Topic 5 - Logic: Nested Quantifiers
Discrete Structures: Topic 5 - Logic: Nested Quantifiers
1
Nested Quantifiers
} Nested quanti9iers are often necessary to express the
meaning of sentences in English as well as important
concepts in computer science and mathematics
} Example:
} “Every real number has an additive inverse” can be
expressed as ∀x ∃y(x + y = 0) where the domains of x and y
are the real numbers
} We can also think of nested propositional functions
} ∀x ∃y(x + y = 0) can be viewed as ∀x Q(x) where Q(x) is
∃y P(x, y) where P(x, y) is (x + y = 0)
2
Order of Quantifiers
} Examples:
} Let P(x,y) be the statement “x + y = y + x” and assume that
U is the real numbers. Then
} ∀x ∀y P(x,y) is true
} ∀y ∀x P(x,y) is true
} Let Q(x,y) be the statement “x + y = 0” and assume that U
is the real numbers. Then
} ∀x ∃y P(x,y) is true
} ∃y ∀x P(x,y) is false
3
Questions on Order of Quantifiers
} Example:
} Let U be the real numbers
} De9ine P(x,y) : x ∙ y = 0
} What is the truth value of the following:
} ∀x ∀y P(x,y)
¨ false
} ∀x ∃y P(x,y)
¨ true
} ∃x ∀y P(x,y)
¨ true
} ∃x ∃y P(x,y)
¨ true
4
Quantifications of Two Variables
Statement
When True?
When False
P(x,y) is true for every There is a pair x, y for
pair x,y
which P(x,y) is false
For every x there is a y for There is an x such that
which P(x,y) is true
P(x,y) is false for every y
There is an x for which For every x there is a y for
P(x,y) is true for every y
which P(x,y) is false
There is a pair x, y for P(x,y) is false for every
which P(x,y) is true
pair x,y
5
Translating Mathematical Statements into
Statements with Nested Quantifiers
} Example :
} Translate “The sum of two positive integers is always positive”
into a logical expression
} Solution:
1. Rewrite the statement to make the implied quanti9iers and
domains explicit:
“For every two integers, if these integers are both positive, then the
sum of these integers is positive”
2. Introduce the variables x and y, and specify the domain, to
obtain:
“For all positive integers x and y, x + y is positive”
3. The result is:
∀x ∀y ((x > 0)∧ (y > 0)→ (x + y > 0))
where the domain of both variables consists of all integers
6
Translating English into Logical Expressions
Example
} Example:
} Use quanti9iers to express the statement “There is a woman
who has taken a 9light on every airline in the world”
} Solution:
1. Let P(w,f,a) be “w has taken 9light f on airline a”
2. The domain of w is all women,
the domain of f is all 9lights, and
the domain of a is all airlines
3. Then the statement can be expressed as:
∃w ∀a ∃f P(w,f,a )
7
Translating Nested Quantifiers into English
} Example 1:
} Translate the statement
∃x ∀y ∀z ((F(x, y)∧ F(x,z) ∧ (y ≠z))→¬F(y,z)) where
} F(x,y) is “x and y are friends” and
} The domain for both x, y and z consists of all students in your
school
} Solution:
} There is a student none of whose friends are also friends
with each other
8
Translating Nested Quantifiers into English
} Example 2:
} Translate the statement ∀x (C(x )∨ ∃y (C(y ) ∧ F(x, y)))
where
} C(x) is “x has a computer”, and
} F(x,y) is “x and y are friends” and
} The domain for both x and y consists of all students in your school
} Solution:
} Every student has a computer or is a friend with someone
who has a computer
9
Exercises on Translation from English
} Choose the obvious predicates and express in predicate logic
} “Brothers are siblings”
} ∀x ∀y (B(x,y) → S(x,y))
} “Siblinghood is symmetric”
} ∀x ∀y (S(x,y) ↔ S(y,x))
} “Everybody loves somebody”
} ∀x ∃y L(x,y)
} “There is someone who is loved by everyone”
} ∃y ∀x L(x,y)
} “There is someone who loves someone”
} ∃x ∃y L(x,y)
} “Everyone loves himself”
} ∀x L(x,x)
} “Everyone loves exactly one other person”
} ∀x ∃y (L(x, y) ∧ ∀z (y ≠z→¬L(x,z)))
10
Negating Nested Quantifiers
} Statements involving nested quanti9iers can be negated by
successively applying the rules for negating statements involving
a single quanti9ier
} Example:
} Recall the logical expression developed few slides back
∃w ∀a ∃f P(w,f,a )
} Use quanti9iers to express the statement that “There does not exist a woman
who has taken a 9light on every airline in the world”
} Solution:
} ¬∃w ∀a ∃f P(w,f,a )
} ∀w ∃a ∀f ¬P(w,f,a )
} In other words, the statements says: “Every women hasn’t taken any
9light on at least one airline in the world”
11
Any Questions?
12