2 Predicate Logic
2 Predicate Logic
2 Predicate Logic
Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Summary
Predicate Logic (First-Order Logic (FOL), Predicate
Calculus)
The Language of Quantifiers
Logical Equivalences
Nested Quantifiers
Translation from Predicate Logic to English
Translation from English to Predicate Logic
Section Summary
Predicates
Variables
Quantifiers
Universal Quantifier
Existential Quantifier
Negating Quantifiers
De Morgan’s Laws for Quantifiers
Translating English to Logic
Propositional Logic Not Enough
If we have:
“All men are mortal.”
“Socrates is a man.”
Now let “x - y = z” be denoted by Q(x, y, z), with U as the integers. Find these
truth values:
Q(2,-1,3)
Solution: T
Q(3,4,7)
Solution: F
Q(x, 3, z)
Solution: Not a Proposition
Compound Expressions
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
Expressions with variables are not propositions and therefore do
not have truth values. For example,
P(3) ∧ P(y)
P(x) → P(y)
When used with quantifiers (to be introduced next), these
expressions (propositional functions) become propositions.
Quantifiers Charles Peirce (1839-1914)
Examples:
1) If P(x) denotes “x > 0” and U is the integers, then x P(x) is
false.
Examples:
1. If P(x) denotes “x > 0” and U is the integers, then x P(x) is
true. It is also true if U is the positive integers.
Examples:
1. If P(x) denotes “x + 1 = 0” and U is the integers, then
!x P(x) is true.
2. But if P(x) denotes “x > 0,” then !x P(x) is false.
Thinking about Quantifiers
When the domain of discourse is finite, we can think of
quantification as looping through the elements of the domain.
To evaluate x P(x) loop through all x in the domain.
If at every step P(x) is true, then x P(x) is true.
If at a step P(x) is false, then x P(x) is false and the loop
terminates.
To evaluate x P(x) loop through all x in the domain.
If at some step, P(x) is true, then x P(x) is true and the loop
terminates.
If the loop ends without finding an x for which P(x) is true, then x
P(x) is false.
Even if the domains are infinite, we can still think of the
quantifiers this fashion, but the loops will not terminate in some
cases.
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:
1. 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.
2. If U is the negative integers and P(x) is the statement
“x < 2”, then both x P(x) andx P(x) are true.
3. If U consists of 3, 4, and 5, and P(x) is the statement
“x > 2”, then both x P(x) and x P(x) are true. But if P(x)
is the statement “x < 2”, then both x P(x) andx P(x) are
false.
Precedence of Quantifiers
The quantifiers and have higher precedence than
all the logical operators.
Even if the domains are infinite, you can still think of the
quantifiers in this fashion, but the equivalent expressions
without quantifiers will be infinitely long.
Negating Quantified Expressions
Consider x D(x)
“Every student in your class has taken a course in Discrete
Mathematics.”
Here D(x) is “x has taken a course in Discrete Mathematics”
and the domain is students in your class.
Decide on predicates and domains (left implicit here) for the variables:
Let L(m, y) be “Mail message m is larger than y megabytes.”
Let C(m) denote “Mail message m will be compressed.”
Let A(u) represent “User u is active.”
Let S(n, x) represent “Network link n is in state x.
Now we have:
MorePredicate Calculus Definitions
The scope of a quantifier is the part of an assertion in
which variables are bound by the quantifier.
If the domains of the variables are infinite, then this process can
not actually be carried out.
Order of Quantifiers
Examples:
1. Let P(x,y) be the statement “x + y = y + x.” Assume
that U is the real numbers. Then xyP(x,y) and
yxP(x,y) have the same truth value.
Solution:
1. Rewrite the statement to make the implied quantifiers 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
Translating English into Logical
Expressions Example
Example: Use quantifiers to express the statement “There is
a woman who has taken a flight on every airline in the
world.”
Solution:
1. Let P(w,f) be “w has taken f ” and Q(f,a) be “f is a flight on
a.”
2. The domain of w is all women, the domain of f is all flights,
and the domain of a is all airlines.
3. Then the statement can be expressed as:
w a f (P(w,f ) ∧ Q(f,a))
Questions on Translation from
English
Choose the obvious predicates and express in predicate logic.
Example 1: “Brothers are siblings.”
Solution: x y (B(x,y) → S(x,y))
Example 2: “Siblinghood is symmetric.”
Solution: x y (S(x,y) → S(y,x))
Example 3: “Everybody loves somebody.”
Solution: x y L(x,y)
Example 4: “There is someone who is loved by everyone.”
Solution: y x L(x,y)
Example 5: “There is someone who loves someone.”
Solution: x y L(x,y)
Example 6: “Everyone loves himself”
Solution: x L(x,x)
Negating Nested Quantifiers
Example 1: Recall the logical expression developed one slide back:
w a f (P(w,f ) ∧ Q(f,a))
Part 1: 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: ¬w a f (P(w,f ) ∧ Q(f,a))
Part 2: Now use De Morgan’s Laws to move the negation as far inwards as
possible.
Solution:
1. ¬w a f (P(w,f ) ∧ Q(f,a))
2. w ¬ a f (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
3. w a ¬ f (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
4. w a f ¬ (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
5. w a f (¬ P(w,f ) ∨ ¬ Q(f,a)) by De Morgan’s for ∧.
Part 3: Can you translate the result back into English?
Solution:
“For every woman there is an airline such that for all flights, this woman has
not taken that flight or that flight is not on this airline.”