Unit#2 Predicates and Quantifiers
Unit#2 Predicates and Quantifiers
Discrete Structures
Unit 2:
Predicates and Quantifiers
4
Universal Quantifier: ∀
⚫ The universal quantifier (∀) indicates that a
predicate is true for all elements in a given
domain.
⚫ Let Q(x) be a predicate and D the domain of x.
A universal statement is a statement of the
form “∀x ∈ D, Q(x).”
⚫ It is defined to be true iff Q(x) is true for every
x in D.
⚫ It is defined to be false iff Q(x) is false for at
least one x in D.
⚫ A value for x for which Q(x) is false is called a
counterexample to the universal statement.
⚫ ∀x ∈ N, x2 ≥ x.
⚫ Find counterexample of ∀x ∈ R, x2 ≥ x. 5
Existential Quantifier: ∃
⚫ Let Q(x) be a predicate and D the domain of x.
An existential statement is a statement of the
form “∃x ∈ D Q(x).”
⚫ It is defined to be true iff Q(x) is true for at lest
one x in D.
⚫ It is defined to be false iff Q(x) is false for all x
in D.
⚫ ∃m ∈ Z+ such that m2 = m.
⚫ ∃ x,y ∈ Z+, x ≥ x +y.
6
Quantifiers over Finite/Restricted Domains
⚫ Quantified statements can be expressed using
propositional logic, when the domain of a
quantifier is finite.
⚫ Let the elements of the domain are x1, x2,…, xn,
⚫ The universal quantification ∀xP(x) is the
same as the conjunction P(x1) ∧ P(x2) ∧⋯∧
P(xn).
⚫ The existnetial quantification ∃xP(x) is the
same as the disjunction P(x1) ∨ P(x2) ∨ ⋯ ∨
P(xn).
2 3 2
⚫ ∀x < 0 (x > 0), ∀y ≠ 0 (y ≠ 0), and ∃z > 0 (z =
2)
7
Quantifiers - Examples
a. All triangles have three sides.
∀ triangles t, t has three sides.
Or: ∀t ∈ T, t has three sides (where T is the set of
all triangles).
b. No dogs have wings.
∀ dogs d, d does not have wings.
Or: ∀d ∈ D, d does not have wings (where D is
the set of all dogs).
c. Some programs are structured.
∃ a program p such that p is structured.
Or: ∃p ∈ P such that p is structured (where P is
the set of all programs).
8
Quantifiers over Finite/Restricted Domains
⚫ Quantified statements can be expressed using
propositional logic, when the domain of a
quantifier is finite.
⚫ Let the elements of the domain are x1, x2,…, xn,
⚫ The universal quantification ∀xP(x) is the
same as the conjunction P(x1) ∧ P(x2) ∧⋯∧
P(xn).
⚫ The existnetial quantification ∃xP(x) is the
same as the disjunction P(x1) ∨ P(x2) ∨ ⋯ ∨
P(xn).
2 3 2
⚫ ∀x < 0 (x > 0), ∀y ≠ 0 (y ≠ 0), and ∃z > 0 (z =
2)
9
Universal Conditional Statements
⚫ ∀x, if P(x) then Q(x).
⚫ ∀x ∈ R, if x > 2 then x2 > 4.
⚫ All bytes have eight bits.
∀x, if x is a byte, then x has eight bits.
10
Predicate Implication
Let P(x) and Q(x) be predicates and suppose the
common domain of x is D.
⚫ The notation P(x) ⇒ Q (x) means that every
element in the truth set of P(x) is in the truth
set of Q(x), or, equivalently,
∀x, P(x) → Q(x).
⚫ The notation P(x) ⇔ Q (x) means that P(x) and
Q(x) have identical truth sets, or, equivalently,
∀x, P(x) ↔ Q(x).
⚫ Example: R(n) → Q(n).
⚫ Q(n) be “n is a factor of 8,” and R(n) be “n is a
factor of 4,”
11
Predicate Negation
Negation of a Universal Statement
⚫ What is the negation of the following
statement?
⚫ “All mathematicians wear glasses.”
⚫ “No mathematicians wear glasses,”
⚫ “There is at least one mathematician who does
not wear glasses.”
⚫ The negation of a universal statement (“all
are”) is logically equivalent to an existential
statement (“some are not” or “there is at least
one that is not”).
⚫ The negation of a statement of the form ∀x in
D, Q(x) is logically equivalent to a statement of
the form ∃x in D such that ∼Q(x). 12
Predicate Negation
Negation of an Existential Statement
⚫ What is the negation of the following
statement?
⚫ “Some snowflakes are the same.”
⚫ “No snowflakes are the same,”
⚫ “All snowflakes are different.”
⚫ The negation of an existential statement
(“some are”) is logically equivalent to a
universal statement (“none are” or “all are
not”).
⚫ The negation of a statement of the form ∃x in
D such that Q(x) is logically equivalent to a
statement of the form ∀x in D,∼Q(x).
⚫ Symbolically, ∼(∃x ∈ D such that Q(x)) ≡ ∀x ∈13
Predicate Negation
Examples
⚫ ∀ primes p, p is odd.
⚫ ∃ a triangle T such that the sum of the angles
of T equals 200◦.
⚫ ∃a prime p such that p is not odd.
⚫ ∀ triangles T, the sum of the angles of T does
not equal 200◦
⚫ Write formal version, formal negation, and
informal negation of the statement “No
politicians are honest.”
⚫ Formal version: ∀ politicians x, x is not honest.
⚫ Formal negation: ∃ a politician x such that x is
honest.
⚫ Informal negation: Some politicians are14
Negations of Universal Conditional Statements
⚫ The negation of a for all statement is:
∼(∀x, P(x) → Q(x)) ≡ ∃x such that ∼(P(x) → Q(x)).
(1)
⚫ The negation of an if-then statement is:
∼(P(x) → Q(x)) ≡ P(x) ∧ ∼Q(x).
(2)
⚫ Substituting (2) into (1) gives:
∼(∀x, P(x) → Q(x)) ≡ ∃x such that (P(x)∧ ∼Q(x)).
⚫ Statement: If a computer program has more
than 100,000 lines, then it contains a bug.
⚫ Negation: There is at least one computer
program that has more than 100,000 lines and
does not contain a bug.
15
The Relation among ∀, ∃,∧, and ∨
⚫ The negation of a for all statement is a there
exists statement, and the negation of a there
exists statement is a for all statement.
⚫ These facts are analogous to De Morgan’s laws,
which state that the negation of an and
statement is an or statement and that the
negation of an or statement is an and
statement.
⚫ Universal statements are generalizations of and
statements, and existential statements are
generalizations of or statements.
⚫ If Q(x) is a predicate and the domain D of X is the set
{x1, x2, . . . , xn}, then the statements ∀x ∈ D, Q(x) and
Q(x1) ∧ Q(x2) ∧ · · · ∧ Q(xn) are logically equivalent. 16
⚫ Similarly, the statements ∃x ∈ D, Q(x) and Q(x ) ∨
Vacuous Truth of Universal Statements
⚫ A bowl has three blue balls, and one red ball.
“All the balls in the bowl are blue”
⚫ A bowl has no balls.
“All the balls in the bowl are blue”
⚫ The above statement is false if, and only if, its
negation is true.
⚫ The negation of the above statement is:
There exists a ball in the bowl that is not blue.
⚫ The negation is false, and so the statement is
true “by default.”
⚫ In general, a statement of the form ∀x in D, if
P(x) then Q(x) is called vacuously true or true
by default if, and only if, P(x) is false for every
x in D. 17
Variants of Universal Conditional Statements
⚫ A conditional statement has a contrapositive, a
converse, and an inverse. The definitions of
these terms can be extended to universal
conditional statements.
⚫ Consider a statement of the form: ∀x ∈ D, if
P(x) then Q(x).
1. Contrapositive: ∀x ∈ D, if ∼Q(x) then ∼P(x).
2. Converse: ∀x ∈ D, if Q(x) then P(x).
3. Inverse: ∀x ∈ D, if ∼P(x) then ∼Q(x).
⚫ Write formal version, contrapositive, converse,
and inverse for the following statement:
“If a real number is greater than 2, then its
square is greater than 4.”
⚫ Formal version: ∀x ∈ R, if x > 2 then x2 > 4. 18
⚫ Contrapositive: ∀x ∈ R, if x2 ≤ 4 then x ≤ 2.
Variants of Universal Conditional Statements
⚫ A conditional statement has a contrapositive, a
converse, and an inverse. The definitions of
these terms can be extended to universal
conditional statements.
⚫ Consider a statement of the form: ∀x ∈ D, if
P(x) then Q(x).
1. Contrapositive: ∀x ∈ D, if ∼Q(x) then ∼P(x).
2. Converse: ∀x ∈ D, if Q(x) then P(x).
3. Inverse: ∀x ∈ D, if ∼P(x) then ∼Q(x).
⚫ Write formal version, contrapositive, converse,
and inverse for the following statement:
“If a real number is greater than 2, then its
square is greater than 4.”
⚫ Formal version: ∀x ∈ R, if x > 2 then x2 > 4. 19
⚫ Contrapositive: ∀x ∈ R, if x2 ≤ 4 then x ≤ 2.
Necessary and Sufficient Conditions, Only If
⚫ “∀x, r (x) is a sufficient condition for s(x)”
means “∀x, if r (x) then s(x).” Knowing that A is
true guarantees that B is also true. However, knowing
that B is true does not guarantee that A is true.
⚫ A condition A(x) is sufficient for a condition
B(x), if existence of A(x) guarantees the
existence of B(x).
⚫ “∀x, r (x) is a necessary condition for s(x)”
means “∀x, if ∼r (x) then ∼s(x)” or, equivalently,
“∀x, if s(x) then r (x).”
⚫ B cannot be true unless A is also true. In other
words, B requires A. However, it is possible for
A to be true even if B is not true.
⚫ A condition A(x) is necessary for a condition 20
B(x), if non-existence of A(x) guarantees the
Necessary and Sufficient Conditions, Only If