0% found this document useful (0 votes)
27 views44 pages

Lecture 2 Predicate Logic-New 2025

Uploaded by

Seif Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views44 pages

Lecture 2 Predicate Logic-New 2025

Uploaded by

Seif Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Ch.

1 The Foundations: Logic and Proofs


• Propositional Logic
• Propositional Logic

• Applications of Propositional Logic

• Propositional Equivalences

II. predicate logic


• predicate logic
Lecture2
• The Language of Quantifiers

• Logical Equivalences Involving Quantifiers

Dr. Mohamed Abdel-Aal • Nested Quantifiers


Discrete Mathematics
Propositional Equivalences
We begin our discussion with a classification of compound propositions according
to their possible truth values.
Tautology
A compound proposition that is always true, no matter what the truth values of
the propositional variables that occur in it

contradiction
A compound proposition that is always false
Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Quiz (2)

Determine whether each of the following is a tautology, a contradiction


or neither:
1. p → (p ∨ q)
2. (p → q) ∧ (¬p ∨ q)
3. (p ∨ q) ↔ (q ∨ p)
4. (p ∧ q) → p
5. (p ∧ q) ∧ (p ∨ q)
6. (p → q) → (p ∧ q)
7. (¬p∧ q) ∧ (p ∨ ¬q)
8. (p → ¬q) ∨ (¬r→ p)
Lecture2 9. [p → (q ∧ r)] ↔ [(p → q) ∧ (p → r)]
10. [(p ∨ q) → r] ⊕(¬p∨ ¬q).

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Logical Equivalences
Compound propositions that have the same truth values in all possible cases are
called logically equivalent.

The compound propositions p and q are called logically equivalent if p ↔ q


is a tautology. The notation p ≡ q denotes that p and q are logically equivalent.

Example
Show that ¬(p ∨ q) and ¬p ∧ ¬q are logically equivalent.
Solution
The truth tables for these compound propositions are

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Example
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are logically equivalent. This is the
distributive law of disjunction over conjunction.
Solution

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Logical Equivalences
Idempotent laws
p∧p≡p
p ∨ p ≡ p.
Commutative laws
p∧q≡q∧p
p∨q≡q∨p
p⊕q≡q⊕p
p ↔ q ≡ q ↔ p.
Associative laws
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
Lecture2 (p ∨ q) ∨ r ≡ p ∨ (q ∨ r)
(p ⊕ q) ⊕ r ≡ p ⊕ (q ⊕ r)
(p ↔ q) ↔ r ≡ p ↔ (q ↔ r).

Absorption laws

Dr. Mohamed Abdel-Aal


p ∧ (p ∨ q) ≡ p
Discrete Mathematics p ∨ (p ∧ q) ≡ p
Distributive laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r).

Involution law

¬(¬p ) ≡ p.

De Morgan’s laws

¬(p ∨ q ) ≡ ¬ p ∧ ¬q
¬ (p ∧ q ) ≡ ¬ p ∨ ¬ q.
Identity laws Complement laws
Lecture2
p∨f≡p
p∨¬p≡t
p∧t≡p
p∧¬p≡f
p∨t≡t
¬f ≡ t
p ∧ f ≡ f.
¬t ≡ f .
Dr. Mohamed Abdel-Aal
Discrete Mathematics
Some useful equivalences for compound propositions involving conditional
statements and biconditional statements in Tables 7 and 8, respectively. The reader is
asked to verify the equivalences in Tables 6–8 in the exercises

More Logical Equivalences

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Replacement Rule
Suppose that we have two logically equivalent propositions P1 and P2, so that
P1 ≡ P2. Suppose also that we have a compound proposition Q in which P1 appears. The
replacement rule says that we may replace P1 by P2 and the resulting proposition is
logically equivalent to Q.
Example
Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are logically equivalent by developing
a series of logical equivalences.
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬(¬p ∧ q) by the second De Morgan law
≡ ¬p ∧[¬(¬p) ∨¬q] by the first De Morgan law
≡ ¬p ∧ (p ∨¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧¬q) by the second distributive law
≡ f ∨ (¬p ∧¬q) because ¬p ∧ p = F
≡ (¬p ∧¬q) ∨ f by the commutative law for disjunction
Lecture2
≡ ¬p ∧¬q by the identity law for F
Example
Show that ¬(p → q) and p ∧¬q are logically equivalent.
¬(p → q) ≡ ¬(¬p ∨ q)
≡ ¬(¬p) ∧¬q by the second De Morgan law
Dr. Mohamed Abdel-Aal ≡ p ∧¬q by the double negation law
Discrete Mathematics
Example
Prove that (¬p ∧ q) ∨ ¬ (p ∨ q) ≡ ¬ p

(¬p ∧ q) ∨ ¬ (p ∨ q) ≡ (¬ p ∧ q) ∨ (¬ p ∧ ¬ q) (De Morgan’s laws)


≡ ¬ p ∧ (q ∨ ¬ q) (distributive laws)
≡¬p∧t (complement laws)
≡ ¬ p. (identity laws)
Example
Show that (p ∧ q) → (p ∨ q) is a tautology.

(p ∧ q) → (p ∨ q) ≡ ¬(p ∧ q) ∨ (p ∨ q)
≡ (¬p ∨¬q) ∨ (p ∨ q)

Lecture2 ≡ (¬p ∨ p) ∨ (¬q ∨ q)


≡t∨t≡t
Quiz (3)
Prove each of the following logical equivalences
1) p ∧ [(p ∨ q) ∨ (p ∨ r)] ≡ p.
Dr. Mohamed Abdel-Aal 2) q ∧ [(p ∨ q) ∧ ¬ (¬ q ∧ ¬ p)] ≡ q.
Discrete Mathematics
Propositional Satisfiability
A compound proposition is satisfiable if there is an assignment of truth values to its
variables that makes it true.

when the compound proposition is false for all assignments of truth values to its
variables, the compound proposition is unsatisfiable.

When we find a particular assignment of truth values that makes a


compound proposition true, we have shown that it is satisfiable; such an
assignment is called a solution of this particular satisfiability problem.
Lecture2 However, to show that a compound proposition is unsatisfiable, we
need to show that every assignment of truth values to its variables makes it
false.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Example
Determine the satisfiability of the following compound propositions:
1. (p ∨ ¬q) ∧ (q ∨ ¬r) ∧(r ∨ ¬p)

Note that (p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p) is true when the three variable p, q, and r
have the same truth value. Hence, it is satisfiable

2. (p ∨ q ∨ r) ∧ (¬p ∨ ¬q ∨ ¬r)

Similarly, it is satisfiable as there is at least one assignment of truth values for p,


q, and r is true and at least one is false that makes it true

Lecture2 3. [(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p)] ∧ [(p ∨ q ∨ r) ∧ (¬p ∨ ¬q ∨ ¬r)]


For the first to be true, the three variables must have the same truth values, and
for the second to be true, at least one of three variables must be true and at least one
must be false. However, these conditions are contradictory. From these observations we
conclude that no assignment of truth values makes it true . Hence, it is unsatisfiable.
Dr. Mohamed Abdel-Aal
Discrete Mathematics
II. predicate logic
In this section we will introduce a more powerful type of logic called
predicate logic

Propositional logic cannot adequately express the meaning of all


statements in mathematics and in natural language. For example,

• “Every computer connected to the university network is


functioning properly.”
Statements involving variables, such as
• “x > 3,” “x = y + 3,” “x + y = z,”
Lecture2 No rules of propositional logic allow us to conclude the truth of the statement

will see how predicate logic can be used to express the meaning of a
wide range of statements in mathematics and computer science in ways that
permit us to reason and explore relationships between objects.
Dr. Mohamed Abdel-Aal
Discrete Mathematics
• “x > 3,”
We can denote the statement “x is greater than 3” by P (x), where P denotes the
predicate “is greater than 3” and x is the variable.

The statement P (x) is also said to be the 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.

Propositional functions are a generalization of propositions.


• They contain variables and a predicate, e.g., P(x)
• Variables can be replaced by elements from their domain.
Example
Let P (x) denote the statement “x > 3.” What are the truth values of P(4)
Lecture2
and P (2)?
Solution
P (4) by setting x = 4 in the statement “x > 3.” Hence, P (4) is true
P (2) by setting x = 2 in the statement “x > 3.” Hence, P (2) is false
Dr. Mohamed Abdel-Aal
Discrete Mathematics
Example
Connectives from propositional logic carry over to predicate logic.
If P(x) denotes “x > 0,” find these truth values:
P(3) ∨ P(-1) Solution: T P(3) ∧ P(-1) Solution: F

P(3) → P(-1) Solution: F P(3) → ¬P(-1) Solution: T

We can also have propositional functions that involve more than


one variable.

Example
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)?
Lecture2
Solution
Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence, Q(1, 2) is the
statement “1 = 2 + 3,” which is false.

Dr. Mohamed Abdel-Aal Q(3, 0) is the proposition “3 = 0 + 3,” which is true.


Discrete Mathematics
Example
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

The proposition R(1, 2, 3) is obtained by setting x = 1, y = 2, and z = 3


in the statement R(x, y, z). We see that 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.


Lecture2

A statement of the form P (x1, x2, . . . , xn) is the value of the propositional
function P at the n-tuple (x1, x2, . . . , xn), and P is also called an n-place
predicate or a n-ary predicate.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Quantifiers
Quantification expresses the extent to which a predicate is true over
a range of elements
We need quantifiers to express the meaning of English words including
all and some

The two most important quantifiers are:


Universal Quantifier, “For all,” symbol: 
Existential Quantifier, “There exists,” symbol: 
We write as in
x P(x) and x P(x).
Lecture2
• x P(x) asserts P(x) is true for every x in the domain.
• x P(x) asserts P(x) is true for some x in the domain.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
The universal quantifier
• We read ∀xP (x) as “for all x P (x)” or “for every x P (x).”

• An element for which P (x) is false is called a counterexample of ∀xP (x)


Example 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?
∀xP (x) is true.
Example
Let P (x) be the statement “x > 0.” What is the truth value of the
quantification ∀xP (x),
• where the domain consists of all integers numbers? ∀xP (x) is false.
Lecture2
• where the domain consists of all positive integers numbers? ∀xP (x) is true.

Example
Let P (x) be the statement “x is even.” What is the truth value of the
quantification ∀xP (x), where the domain consists of all real numbers?
Dr. Mohamed Abdel-Aal
Discrete Mathematics
∀xP (x) is false.
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?
Solution
The statement ∀xP (x) is the same as the conjunction
P (1) ∧ P (2) ∧ P (3) ∧ P (4),
because the domain consists of the integers 1, 2, 3, and 4. Because P (4),
which is the statement “42 < 10,” is false, it follows that ∀xP (x) is false.

What does the statement ∀xN(x) mean if N(x) is “Computer x is connected


to the network” and the domain consists of all computers on campus?

Lecture2 Solution
The statement ∀xN(x) means that for every computer x on campus, that
computer x is connected to the network. This statement can be
expressed in English as
“Every computer on campus is connected to the network.”
Dr. Mohamed Abdel-Aal
Discrete Mathematics
Example
What is the truth value of if the domain consists of all real
numbers? What is the truth value of this statement if the domain consists of
all integers?
Solution
• where the domain consists of all real numbers, is false. For
example, .

• is true, because there are no integers x with 0 < x < 1.

The Existential quantifier


We use the notation ∃xP (x) for the existential quantification of P (x).
Lecture2
Here ∃ is called the existential quantifier
∃xP (x) is read as
“There is an x such that P (x),”
“There is at least one x such that P (x),”
or
Dr. Mohamed Abdel-Aal “For some xP (x).”
Discrete Mathematics
Example
Let P (x) be the statement “x > 3.” What is the truth value of the
quantification ∃xP (x), where the domain consists of all real numbers?
∃xP (x), is true.

• Observe that the statement ∃xP (x) is false if and only if there is no
element x in the domain for which P (x) is true.

Example
Let P (x) be the statement “x > 0.” What is the truth value of the
quantification ∃xP (x)

• where the domain consists of all integers numbers? ∃xP (x) is true.
Lecture2

• where the domain consists of all negative integers numbers?

∀xP (x) is false.


Dr. Mohamed Abdel-Aal
Discrete Mathematics
Remark: Generally, an implicit assumption is made that all domains of discourse for
quantifiers are nonempty. If the domain is empty, then ∃xQ(x) is false whenever Q(x) is a
propositional function because when the domain is empty, there can be no element x in the
domain for which Q(x) is true.
the existential quantification ∃xP(x) is the same as the disjunction When all elements in the
domain can be listed say,
x1, x2, . . . , xn
P (x1) ∨ P (x2) ∨ P (x3) ∨ P (x4),
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 domain consists of the positive integers not exceeding 4?
Lecture2
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.
Dr. Mohamed Abdel-Aal
Discrete Mathematics
The uniqueness quantifier
the uniqueness quantifier, denoted by ∃! or ∃1.The notation ∃! xP (x)
[or ∃1xP (x)] states “There exists a unique x such that P (x) is true.”

“there is exactly one” and “there is one and only one.”) For instance,
∃!x (x − 1 = 0), where the domain is the set of real numbers,

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Properties of Quantifiers

The truth value of x P(x) and  x P(x) depend on both the propositional
function P(x) and on the domain U.

Examples
• If U is the positive integers and P(x) is the statement “x < 2”,
then x P(x) is true, but  x P(x) is false.

• If U is the negative integers and P(x) is the statement “x < 2”,


then both x P(x) and  x P(x) are true.
If U consists of 3, 4, and 5, and P(x) is the statement “x > 2”,
Lecture2
both x P(x) and  x P(x) are true.
But if P(x) is the statement “x < 2”, then both x P(x) and  x P(x)
are false.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Quantifiers with Restricted Domains

Example
What do the statements ∀x < 0 (𝑥 2 > 0), ∀y = 0 (𝑦 3 = 0), and ∃z > 0 (𝑧 2 = 2)
mean, where the domain in each case consists of the real numbers?
Solution
The statement ∀x < 0 (𝑥 2> 0) is the same as ∀x (x < 0 → 𝑥 2 > 0).

The statement ∀y = 0 (𝑦 3 = 0), this statement is equivalent to ∀y(y = 0 → 𝑦 3 = 0)


Note that the restriction of a universal quantification is the same
as the universal quantification of a conditional statement

the statement ∃z > 0 (𝑧 2 = 2), this statement is equivalent to ∃z(z > 0 ∧ 𝑧 2 = 2).
the restriction of an existential quantification is the same as
Lecture2 the existential quantification of a conjunction.
Precedence of Quantifiers
The quantifiers ∀ and ∃ have higher precedence than all logical operators
from propositional calculus.
For example,
∀xP (x) ∨ Q(x) is the disjunction of ∀xP (x) and Q(x). In other words, it
Dr. Mohamed Abdel-Aal
Discrete Mathematics means (∀xP (x)) ∨ Q(x) rather than ∀x(P (x) ∨ Q(x)).
Logical Equivalences Involving Quantifiers
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. S ≡ T

Examples
Show that ∀x(P (x) ∧ Q(x)) and ∀xP (x) ∧ ∀xQ(x) are logically equivalent

we must show that they always take the same truth value, no matter
what the predicates P and Q are, and no matter which domain of discourse
is used.
Lecture2
Suppose we have particular predicates P and Q, with a common domain.
• First, we show that if ∀x(P (x) ∧ Q(x)) is true, then ∀xP (x) ∧ ∀xQ(x) is true.

• Second, we show that if ∀xP (x) ∧ ∀xQ(x) is true, then ∀x(P (x) ∧ Q(x)) is true.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
So, 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 in the domain, we can conclude that ∀xP (x) and
∀xQ(x) are both true. This means that ∀xP (x) ∧ ∀xQ(x) is true.

Next, 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 . 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:
Lecture2
∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x).

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Negating Quantified Expressions

“Every student in your class has taken a course in calculus.”

This statement is a universal quantification, namely ∀xP (x)

where P (x) is the statement “x has taken a course in calculus” and the domain
consists of the students in your class
The negation of this statement is
“It is not the case that every student in your class has taken a course in calculus.”
This is equivalent to
Lecture2 “There is a student in your class who has not taken a course in calculus.”
∃x ¬P (x).
This example illustrates the following logical equivalence:

Dr. Mohamed Abdel-Aal ¬∀x P (x) ≡ ∃x ¬P (x)


Discrete Mathematics
There is a student in this class who has taken a course in calculus.”
This is the existential quantification ∃x Q(x) ,
The negation of this statement is the proposition
“It is not the case that there is a student in this class who has taken
a course in calculus.”
This is equivalent to
“Every student in this class has not taken calculus,” ∀x ¬Q(x).

¬ ∃x Q(x) ≡ ∀x ¬Q(x).

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Examples
What are the negations of the statements ∀x (𝑥 2 > x) and ∃x(𝑥 2 = 2)?

Solution
The negation of ∀x(𝑥 2 > x) is the statement ¬∀x(𝑥 2 > x), which is
equivalent to ∃x¬(𝑥 2 > x). This can be rewritten as ∃x(𝑥 2 ≤ x).
The negation of ∃x (𝑥 2 = 2) is the statement ¬∃x (𝑥 2 = 2), which is
equivalent to ∀x ¬ (𝑥 2 = 2). This can be rewritten as ∀x(𝑥 2 ≠ 2).
Examples
Show that ¬∀x(P (x) → Q(x)) and ∃x(P (x) ∧ ¬Q(x)) are logically equivalent.

Lecture2 ¬∀x (P (x) → Q(x)) ≡ ∃x (¬(P (x) → Q(x))) (De Morgan’s law for universal quantifiers )
≡ ∃x (P (x) ∧ ¬Q(x) ) (By the fifth logical equivalence in Table 7 )

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Translating from English into Logical Expressions

Examples
Express the statements “Some student in this class has visited Mexico”
and “Every student in this class has visited either Canada or Mexico”
using predicates and quantifiers.
Solution
We introduce M(x), which is the statement “x has visited Mexico.” and
S(x) to represent “x is a student in this class.”

the domain for the variable x consists of all people.

Lecture2 • Our solution becomes ∃x (S(x) ∧ M(x))


Let C(x), which is the statement “x has visited Canada .”

• ∀x(S(x) → (C(x) ∨ M(x)))

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Examples
Translate the following sentence into predicate logic:
“Every student in this class has taken a course in Java.”
Solution
First decide on the domain U.
Solution 1: If U is all students in this class, define a propositional
function J(x) denoting “x has taken a course in Java” and translate
as x J(x).
Solution 2: But if U is all people, also define a propositional
function S(x) denoting “x is a student in this class” and translate as
x (S(x)→ J(x)).
all people are students in this class and
x (S(x) ∧ J(x)) is not correct. What does it mean? have studied Java
Examples
Translate the following sentence into predicate logic:
“Some student in this class has taken a course in Java.”
Lecture2
Solution
First decide on the domain U.
Solution 1: If U is all students in this class, translate as
x J(x)
Solution 2: But if U is all people, then translate as
x (S(x) ∧ J(x))
Dr. Mohamed Abdel-Aal x (S(x)→ J(x)) is not correct. What does it mean?
Discrete Mathematics
• We will see how to use nested quantifiers to express mathematical
statements such as
“The sum of two positive integers is always positive.”
• We will show how nested quantifiers can be used to translate
English sentences such as
“Everyone has exactly one best friend”
Into logical statements.
Lecture2
• ∀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


Dr. Mohamed Abdel-Aal
Discrete Mathematics
Understanding Statements Involving Nested Quantifiers
in Section 1.4 we avoided nested quantifiers, where one quantifier is within the
scope of another, such as
Example: “Every real number has an inverse” is
∀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).

Lecture2 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.
Dr. Mohamed Abdel-Aal
Discrete Mathematics
Examples
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 real numbers x and y, if x is positive
and y is negative, then xy is negative.

Lecture2 The Order of Quantifiers

It is important to note that the order of the quantifiers is important,


unless all the quantifiers are universal quantifiers or all are existential
quantifiers.
Dr. Mohamed Abdel-Aal
Discrete Mathematics
Examples Let P (x, y) be the statement “x + y = y + x.” What are the truth values of the
quantifications ∀x ∀y P (x, y) and ∀y∀xP (x, y) where the domain for all
variables consists of all real numbers?

∀x ∀y P (x, y) and ∀y ∀x P (x, y) have the same meaning, and both are true

Examples
Let Q(x, y) denote “x + y = 0.” What are the truth values of the
quantifications ∃y ∀x Q(x, y) and ∀x ∃y Q(x, y), where the domain for
all variables consists of all real numbers?
Solution
∃y ∀x Q(x, y)
Lecture2 denotes the proposition:
“There is a real number y such that for every real number x, Q(x, y).”
Because
there is no real number y such that x + y = 0 for all real numbers x, the
statement ∃y ∀x Q(x, y) is false
Dr. Mohamed Abdel-Aal
Discrete Mathematics
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

Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Define P(x,y) : x ∙ y = 0, where the domain for all variables consists of all
real numbers. 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
Quiz (1)

Define P(x,y) : x / y = 1, where the domain for all variables consists of all
real numbers. What is the truth value of the following:
Lecture2 ∀x∀y P(x,y) ………..……
∀x ∃y P(x,y) ……….…….
∃ x ∀ y P(x,y) ……………..
∃ x ∃ y P(x,y) …………….

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Translating Mathematical Statements into Statements Involving Nested
Quantifiers

Examples Translate the statement “The sum of two positive integers is always
positive” into a logical expression
we can express this statement as
∀x ∀y ((x > 0) ∧ (y > 0) → (x + y > 0))
where the domain for both variables consists of all integers.
Note that we could also translate this using the positive integers as
the domain. We can express this as
Lecture2 ∀x ∀y (x + y > 0).
Examples
Translate the statement “Every real number except zero
has a multiplicative inverse.”
This can be rewritten as
Dr. Mohamed Abdel-Aal
Discrete Mathematics
∀x ((x ≠ 0) → ∃y (xy = 1)).
Translating from Nested Quantifiers into English
• The first step in translating such an expression is to write out what the
quantifiers and predicates in the expression mean.
• The next step is to express this meaning in a simpler sentence.

Examples 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.
• Every student in your school has a computer or has a friend who has a computer.
• every student x in your school, x has a computer or there is a student y such that
y has a computer and x and y are friends.
Lecture2
Translate the statement
Examples
xy z ((F(x, y)∧ F(x,z) ∧ (y ≠z))→¬F(y,z))

there is a student x such that for all students y and all students z other than y, if x and y are
friends and x and z are friends, then y and z are not friends. In other words, there is a student
Dr. Mohamed Abdel-Aal none of whose friends are also friends with each other.
Discrete Mathematics
Thinking of Nested Quantification

Nested Loops
 To see if ∀x ∀y p(x,y) is true, loop through the values of x :
• At each step, loop through the values for y.
• If for some pair of x and y, P(x,y) is false, then ∀x ∀y p (x,y) is false and both the
outer and inner loop terminate.
• ∀x ∀y p (x,y) is true if the outer loop ends after stepping through each x
 To see if ∀x ∃y P(x,y) is true, loop through the values of x:
• At each step, loop through the values for y.
• The inner loop ends when a pair x and y is found such that P(x, y) is true.
• If no y is found such that P(x, y) is true the outer loop terminates as ∀x ∃y P(x,y)
Lecture2 has been shown to be false.
• ∀x ∃y P(x,y) is true if the outer loop ends after stepping through each x.

If the domains of the variables are infinite, then this process can not actually
be carried out.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Negating Nested Quantifiers

Express the negation of the statement ∀x ∃y (xy = 1)

Solution
applying De Morgan’s laws for quantifiers, we can move the negation in
¬∀x∃y(xy = 1) inside all the quantifiers. We find that
¬∀x ∃y (xy = 1) ≡ ∃x ¬∃y (xy = 1),
≡ ∃x ∀y ¬(xy = 1).
≡ ∃x ∀y (xy ≠ 1).
we conclude that our negated
statement can be expressed as ∃x ∀y (xy ≠ 1).
Lecture2

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Some Questions about Quantifiers

Can you switch the order of quantifiers?


Is this a valid equivalence?
Solution: Yes! The left and the right side will always have the same truth value. The
order in which x and y are picked does not matter.
Is this a valid equivalence?
Solution: No! The left and the right side may have different truth values for some
propositional functions for P. Try “x + y = 0” for P(x,y) with U being the integers. The order
in which the values of x and y are picked does matter.
Can you distribute quantifiers over logical connectives?
Is this a valid equivalence?
Solution: Yes! The left and the right side will always have the same truth value no
matter what propositional functions are denoted by P(x) and Q(x).
Lecture2 Is this a valid equivalence?
Solution: No! The left and the right side may have different truth values. Pick “x is a
fish” for P(x) and “x has scales” for Q(x) with the domain of discourse being all animals. Then
the left side is false, because there are some fish that do not have scales. But the right side is
true since not all animals are fish.

Dr. Mohamed Abdel-Aal


Discrete Mathematics
Mistakes in Proofs
Each step of a mathematical proof needs to be correct and the conclusion
needs to follow logically from the steps that precede it.
Example

Lecture 3
Solution
We use these steps, where a and b are two equal positive integers.

Every step is valid except for one, step 5 where we divided both sides by
a - b. The error is that a - b equals zero; division of both sides of an equation
Dr. Mohamed Abdel-Aal
Discrete Mathematics
by the same quantity is valid as long as this quantity is not zero.

You might also like