Discrete Mathematics (4) (5) (6) Quantifiers
Discrete Mathematics (4) (5) (6) Quantifiers
Quantifier
Session 4-6
Acknowledgement
Chapter 1
2
Learning Objectives
LO1:
Evaluate the logic of compound,
quantified statements and method
of proof related to discrete
problems
Sub Topics
• Predicates
1
• Quantifiers
2
• Negating Quantified Expressions
3
• Nested Quantifiers
4
4
Introduction
❑ Predicates : statements are neither true nor false when the values of
the variables are not specified.
Example :
1. x > 3
2. x = y + 3
3. x + y = z
4. Computer x is functioning properly.
❑ The statement “x is greater than 3” has two parts. The first part, the
variable x, is the subject of the statement. The second part—the
predicate. “is greater than 3”—refers to a property that the subject of
the statement can have. Denote by P(x).
❑ P(x) : value of the propositional function P at x. Once a value has
been assigned to the variable x, the statement P(x) becomes a
proposition and has a truth value.
Predicates
Predicates
Example 01 :
Let Q(x, y) denote the statement “x = y + 3.” What are the truth values of the
propositions Q(1, 2) and Q(3, 0)?
Solution :
Q(1, 2) is the statement “1 = 2 + 3,” which is false.
Q(3, 0) is the proposition “3 = 0 + 3,” which is true.
Example 02 :
Let R(x, y, z) denote the statement “x + y = z.” What are the truth values of
the propositions R(1, 2, 3) and R(0, 0, 1)?
Solution :
R(1, 2, 3) is the statement “1 + 2 = 3,” which is true.
R(0, 0, 1), which is the statement “0 + 0 = 1,” is false.
Preconditions And Postconditions
Example :
Consider the following program, designed to interchange the values of two
variables x and y.
temp := x
x := y
y := temp
Find predicates that we can use as the precondition and the postcondition
to verify the correctness of this program. Then explain how to use them to
verify that for all valid input the program does what is intended !
Preconditions And Postconditions
Solution :
✓ For the postcondition we can use Q(x, y), where Q(x, y) is the statement
“x = b and y = a.”
Definition :
The universal quantification of P(x) is the statement
“P(x) for all values of x in the domain.”
The notation ∀xP(x) denotes the universal quantification of P(x). Here ∀
is called the universal quantifier. We read ∀xP(x) as “for all xP(x)” or
“for every xP(x).” An element for which P(x) is false is called a
counterexample to ∀xP(x).
The Universal Quantifier
Example 01:
Let P(x) be the statement “x + 1 > x.” What is the truth value of the
quantification ∀xP(x), where the domain consists of all real numbers?
Solution:
Because P(x) is true for all real numbers x, the quantification ∀xP(x) is true.
Example 02:
a. What is the truth value of ∀x(𝑥 2 ≥ x) if the domain consists of all real
numbers?
b. What is the truth value of this statement if the domain consists of all
integers?
Solution:
a. This statement is false. For example, (1/2)2 ≱ ½.
b. 𝑥 2 ≥ x if and only if 𝑥 2 − x = x(x − 1) ≥ 0. Consequently, x ≤ 0 or x ≥ 1.
However, if the domain consists of the integers, ∀x(𝑥 2 ≥ x) is true.
The Existential Quantifier
Definition :
The existential quantification of P(x) is the proposition
“There exists an element x in the domain such that P(x).”
We use the notation ∃xP(x) for the existential quantification of P(x).
Here ∃ is called the existential quantifier.
The Existential Quantifier
Example 01 :
Let P(x) denote the statement “x > 3.” What is the truth value of the
quantification ∃xP(x), where the domain consists of all real numbers?
Solution:
Because “x > 3” is sometimes true, for instance, when x = 4, the existential
quantification of P(x), which is ∃xP(x), is true.
Example 02 :
Let Q(x) denote the statement “x=x+1.” What is the truth value of the
quantification ∃xQ(x), where the domain consists of all real numbers?
Solution: Because Q(x) is false for every real number x, the existential
quantification of Q(x), which is ∃xQ(x), is false.
Quantifiers Over Finite Domains
Quantifiers Over Finite Domains
1. Universal Quantification
When the elements of the domain are x1, x2,…, xn, where n is a
positive integer, the universal quantification ∀xP(x) is the same as the
conjunction
P(x1) ∧ P(x2) ∧⋯∧ P(xn),
because this conjunction is true if and only if P(x1), P(x2),…, P(xn) are all
true.
Example:
What is the truth value of ∀xP(x), where P(x) is the statement “𝑥 2 < 10” and
the domain consists of the positive integers not exceeding 4?
2. Existential quantification
When the elements of the domain are x1, x2,…, xn, where n is a
positive integer, the existential quantification ∃xP(x) is the same as the
disjunction
P(x1) ∨ P(x2) ∨⋯∨ P(xn),
because this disjunction is true if and only if at least one of P(x1), P(x2),…,
P(xn) is true.
Example
What is the truth value of ∃xP(x), where P(x) is the statement “𝑥 2 > 10” and
the universe of discourse consists of the positive integers not exceeding
4?
Solution:
Because the domain is {1, 2, 3, 4}, the proposition ∃xP(x) is the same as
the disjunction
P(1) ∨ P(2) ∨ P(3) ∨ P(4).
Because P(4), which is the statement “42 > 10,” is true, it follows that ∃xP(x)
is true.
Quantifiers with Restricted Domains
Example :
What do the statements mean where the domain in each case consists of
the real numbers?
a. ∀x < 0 (𝑥 2 > 0),
b. ∀y ≠ 0 (𝑦 3 ≠ 0), and
c. ∃z > 0 (𝑧 2 = 2)
Solution:
a. The statement ∀x < 0 (𝑥 2 > 0) states that for every real number x with x <
0, 𝑥 2 > 0. This statement is the same as ∀x(x < 0 → 𝑥 2 > 0).
b. The statement ∀y ≠ 0 (𝑦 3 ≠ 0) states that for every real number y with y ≠
0, we have 𝑦 3 ≠ 0.” This statement is equivalent to ∀y(y ≠ 0 → 𝑦 3 ≠ 0).
c. The statement ∃ z> 0 (𝑧 2 = 2) states that there exists a real number z with
z > 0 such that 𝑧 2 = 2.” This statement is equivalent to ∃z(z > 0 ∧ 𝑧 2 = 2).
Logical Equivalences Involving
Quantifiers
Definition :
Statements involving predicates and quantifiers are logically
equivalent if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used for the variables in these propositional functions. We
use the notation S ≡ T to indicate that two statements S and T involving
predicates and quantifiers are logically equivalent.
Example :
Show that ∀x(P(x) ∧ Q(x)) and ∀xP(x) ∧ ∀xQ(x) are logically equivalent (where
the same domain is used throughout).
Solution :
Suppose we have particular predicates P and Q, with a common domain.
Logical Equivalences Involving
Quantifiers
Solution :
1. We show that if ∀x(P(x) ∧ Q(x)) is true, then ∀xP(x) ∧ ∀xQ(x) is true.
Suppose that ∀x(P(x) ∧ Q(x)) is true. This means that if a is in the
domain, then P(a) ∧ Q(a) is true. Hence, P(a) is true and Q(a) is true.
Because P(a) is true and Q(a) is true for every element a in the domain,
we can conclude that ∀xP(x) and ∀xQ(x) are both true. This means that
∀xP(x) ∧ ∀xQ(x) is true.
2. We show that if ∀xP(x) ∧ ∀xQ(x) is true, then ∀x(P(x) ∧ Q(x)) is true.
Suppose that ∀xP(x) ∧ ∀xQ(x) is true. It follows that ∀xP(x) is true and
∀xQ(x) is true. Hence, if a is in the domain, then P(a) is true and Q(a) is
true [because P(x) and Q(x) are both true for all elements in the domain,
there is no conflict using the same value of a here]. It follows that for all
a, P(a) ∧ Q(a) is true. It follows that ∀x(P(x) ∧ Q(x)) is true. We can now
conclude that
∀x(P(x) ∧ Q(x)) ≡ ∀xP(x) ∧ ∀xQ(x).
Negating Quantified Expressions
Negating Quantified Expressions
Negating Quantified Expressions
Example 01:
What are the negations of the statements
a. “There is an honest politician” and
b. “All Americans eat cheeseburgers”?
Solution :
a. Let H(x) : “x is honest.”
∃xH(x) : “There is an honest politician”,
The negation is ¬∃xH(x) ≡ ∀x ¬ H(x) : “Every politician is dishonest.”
Example 02 :
What are the negations of the statements :
a. ∀x(𝑥 2 > x) and
b. ∃x(𝑥 2 = 2)?
Solution:
a. The negation of ∀x(𝑥 2 > x) is
¬ ∀x(𝑥 2 > x) ≡ ∃x ¬(𝑥 2 > x) ≡ ∃x(𝑥 2 ≤ x).
a. The negation of ∃x(𝑥 2 = 2) is
¬ ∃x(𝑥 2 = 2) ≡ ∀x ¬(𝑥 2 = 2) ≡ ∀x(𝑥 2 ≠ 2).
The truth values of these statements depend on the domain.
Using Quantifiers in System
Specifications
Example 01 :
Use predicates and quantifiers to express the system specifications
a. “Every mail message larger than one megabyte will be compressed”
b. “If a user is active, at least one network link will be available.”
Solution :
a. Let S(m, y) : “Mail message m is larger than y megabytes,”
where the variable x has the domain of all mail messages
and the variable y is a positive real number,
C(m) : “Mail message m will be compressed.”
Then the specification :
“Every mail message larger than one megabyte will be compressed”
= ∀m(S(m, 1) → C(m)).
Using Quantifiers in System
Specifications
Solution :
b. Let A(u) : “User u is active,”
where the variable u has the domain of all users,
S(n, x) : “Network link n is in state x,”
where n has the domain of all network links and x has the
domain of all possible states for a network link.
Then the specification :
“If a user is active, at least one network link will be available”
= ∃uA(u) → ∃nS(n, available).
Using Quantifiers in System
Specifications
Example 02:
Consider these statements. The first two are called premises and the third
is called the conclusion. The entire set is called an argument.
“All lions are fierce.”
“Some lions do not drink coffee.”
“Some fierce creatures do not drink coffee.”
Solution :
Let P(x) : “x is a lion,”
Q(x) : “x is fierce,”
R(x) : “x drinks coffee”
Using Quantifiers in System
Specifications
Solution:
We can express these statements as
∀x(P(x) → Q(x)).
∃x(P(x) ∧ ¬R(x)).
∃x(Q(x) ∧ ¬R(x)).
Note:
✓ Second statement cannot be written as ∃x(P(x) → ¬R(x)). The reason is
that P(x) → ¬R(x) is true whenever x is not a lion, so that ∃x(P(x) → ¬R(x))
is true as long as there is at least one creature that is not a lion, even if
every lion drinks coffee.
✓ The third statement cannot be written as ∃x(Q(x) → ¬ R(x)).
Using Quantifiers in System
Specifications
Example 03:
Consider these statements, of which the first three are premises and the
fourth is a valid conclusion.
“All hummingbirds are richly colored.”
“No large birds live on honey.”
“Birds that do not live on honey are dull in color.”
“Hummingbirds are small.”
Solution :
Let P(x) : “x is a hummingbird,”
Q(x) : “x is large”
R(x) : “x lives on honey”
S(x) : “x is richly colored
Using Quantifiers in System
Specifications
Solution:
We can express the statements in the argument as
∀x(P(x) → S(x)).
¬∃x(Q(x) ∧ R(x)).
∀x(¬ R(x) → ¬ S(x)).
∀x(P(x) → ¬ Q(x)).
Note:
assumed that “small” is the same as “not large” and that “dull in color” is
the same as “not richly colored.”
Nested Quantifiers
Understanding Statements Involving
Nested Quantifiers
Assume that the domain for the variables x and y consists of all real
numbers. The statement
∀x∀y (x + y = y + x)
says that x + y = y + x for all real numbers x and y. This is the
commutative law for addition of real numbers.
The statement
∀x∃y (x + y = 0)
says that for every real number x there is a real number y such that x + y =
0.
This states that every real number has an additive inverse.
Similarly, the statement
∀x∀y∀z (x + (y + z) = (x + y) + z)
is the associative law for addition of real numbers
Understanding Statements Involving
Nested Quantifiers
Example :
Translate into English the statement :
∀x∀y ((x > 0) ∧ (y < 0) → (xy < 0))
where the domain for both variables consists of all real numbers.
Solution:
This statement says that for every real number x and for every real
number y, if x > 0 and y < 0, then xy < 0.
That is, this statement says that for real numbers x and y, if x is positive
and y is negative, then xy is negative.
This can be stated more succinctly as
“The product of a positive real number and a negative real number
is always a negative real number.”
The Order of Quantifiers
Example 01 :
Let Q(x, y) denote “x + y = 0.” What are the truth values of the
quantifications a. ∃y∀x Q(x, y)
b. ∀x∃y Q(x, y)
where the domain for all variables consists of all real numbers?
Solution:
a. The quantification ∃y∀x Q(x, y) denotes the proposition :
“There is a real number y such that for every real number x, Q(x, y)”
No matter what value of y is chosen, there is only one value of x for
which
x + y = 0. Because there is no real number y such that x + y = 0 for all real
numbers x, the statement ∃y∀xQ(x, y) is false.
The Order of Quantifiers
Solution :
b. The quantification ∀x∃y Q(x, y)
denotes the proposition
“For every real number x there is a real number y such that Q(x,
y).”
Given a real number x, there is a real number y such that x + y = 0;
namely, y = −x.
Hence, the statement ∀x∃yQ(x, y) is true.
The Order of Quantifiers
Example 02 :
Let Q(x, y, z) be the statement “x+y=z.” What are the truth values of the
statements
a. ∀x∀y∃z Q(x, y, z)
b. ∃z∀x∀y Q(x, y, z),
where the domain of all variables consists of all real numbers?
Solution:
a. Suppose that x and y are assigned values. Then, there exists a real
number z such that
x+y=z
Consequently, the quantification ∀x∀y∃z Q(x, y, z), which is the statement
“For all real numbers x and for all real numbers y there is a real
number z such that x + y = z,” is true.
The Order of Quantifiers
Solution:
b. The order of the quantification here is important, because the
quantification
∃z∀x∀y Q(x, y, z)
which is the statement
“There is a real number z such that for all real numbers x and for
all real numbers y it is true that x + y = z,”
is false, because there is no value of z that satisfies the equation x + y =
z for all values of x and y.
Quantifications of Two Variables
Negating Nested Quantifiers
Example 01 :
Express the negation of the statement ∀x∃y (xy = 1) so that no negation
precedes a quantifier.
Solution :
¬ ∀x∃y(xy = 1) ≡ ∃x ¬ ∃y(xy = 1) ≡ ∃x∀y ¬(xy = 1).
Because ¬(xy = 1) can be expressed more simply as xy ≠ 1,
negated this statement can be expressed as ∃x∀y(xy ≠ 1)
Negating Nested Quantifiers
Example 02 :
Use quantifiers to express the statement that
“There does not exist a woman who has taken a flight on every airline in
the world.”
Solution :
This statement is the negation of the statement :
“There is a woman who has taken a flight on every airline in the world”
First statement can be expressed as : ¬∃w∀a∃f (P(w, f ) ∧ Q( f, a)),
where P(w, f) is “w has taken f ” and Q( f, a) is “f is a flight on a.”
Negating Nested Quantifiers