02 Predicate Logic 4p
02 Predicate Logic 4p
Proofs
Chapter 1, Part II: Predicate Logic
Predicates and Quantifiers
Section 1.4
Later we’ll see how to draw inferences. Often the domain is denoted by U. So in this example U is the
integers.
Propositional functions are a generalization of Now let “x - y = z” be denoted by Q(x, y, z), with U as the
integers. Find these truth values:
propositions. Q(2,-1,3)
Solution: T
• They contain variables and a predicate, e.g., P(x) Q(3,4,7)
Solution: F
• Variables can be replaced by elements from their Q(x, 3, z)
Solution: Not a Proposition
domain.
Compound Expressions Universal Quantifier
Connectives from propositional logic carry over to predicate logic. x P(x) is read as “For all x, P(x)” or “For every x, P(x)”
If P(x) denotes “x > 0,” find these truth values:
Examples:
P(3) ∨ P(-1) Solution: T
P(3) ∧ P(-1) Solution: F 1) If P(x) denotes “x > 0” and U is the integers, then x
P(3) → P(-1) Solution: F P(x) is false.
P(3) → ¬P(-1) Solution: T 2) If P(x) denotes “x > 0” and U is the positive integers,
Expressions with variables are not propositions and therefore do then x P(x) is true.
not have truth values. For example,
3) If P(x) denotes “x is even” and U is the integers, then
P(3) ∧ P(y)
x P(x) is false.
P(x) → P(y)
When used with quantifiers (to be introduced next), these
expressions (propositional functions) become propositions.
Charles
Quantifiers Peirce Existential Quantifier
(1839-1914)
We need quantifiers to express the meaning of English words x P(x) is read as “For some x, P(x)”, or as “There
including all and some:
is an x such that P(x),” or “For at least one x, P(x).”
• “All men are Mortal.”
• “Some cats do not have fur.” Examples:
The two most important quantifiers are:
1. If P(x) denotes “x > 0” and U is the integers, then x
• Universal Quantifier, “For all,” symbol: P(x) is true. It is also true if U is the positive integers.
• Existential Quantifier, “There exists,” symbol:
2. If P(x) denotes “x < 0” and U is the positive integers,
We write as in x P(x) and x P(x).
then x P(x) is false.
x P(x) asserts P(x) is true for every x in the domain.
3. If P(x) denotes “x is even” and U is the integers, then
x P(x) asserts P(x) is true for some x in the domain.
x P(x) is true.
The quantifiers are said to bind the variable x in these
expressions.
Uniqueness Quantifier (optional) Properties of Quantifiers
!x P(x) means that P(x) is true for one and only one x in the The truth value of x P(x) and x P(x) depend on both
universe of discourse. the propositional function P(x) and on the domain U.
This is commonly expressed in English in the following equivalent
ways: Examples:
• “There is a unique x such that P(x).” 1. If U is the positive integers and P(x) is the statement “x < 2”,
• “There is one and only one x such that P(x)” then x P(x) is true, but x P(x) is false.
Examples:
2. If U is the negative integers and P(x) is the statement “x < 2”,
1. If P(x) denotes “x + 1 = 0” and U is the integers, then !x P(x) is true. then both x P(x) and x P(x) are true.
2. But if P(x) denotes “x > 0,” then !x P(x) is false.
3. If U consists of 3, 4, and 5, and P(x) is the statement “x < 2”,
The uniqueness quantifier is not really needed as the restriction
then both x P(x) and x P(x) are true. But if P(x) is the
that there is a unique x such that P(x) can be expressed as:
statement “x <2”, then both x P(x) and x P(x) are false.
x (P(x) ∧y (P(y) → y =x)
If U consists of the integers 1,2, and 3: Where J(x) is “x has taken a course in Java.”
Negating the original statement gives “It is not the
xP ( x ) P (1) P ( 2 ) P ( 3)
case that there is a student in this class who has
xP ( x ) P (1) P ( 2 ) P ( 3) taken Java.” This implies that “Every student in this
class has not taken Java”
Even if the domains are infinite, you can still think of the
quantifiers in this fashion, but the equivalent expressions Symbolically¬ x J(x) and x ¬ J(x) are equivalent
without quantifiers will be infinitely long.
Some Fun with Translating from English Some Fun with Translating from English
into Logical Expressions 1 into Logical Expressions 3
U = {fleegles, snurds, thingamabobs} The first two are called premises and the third is called the
conclusion.
F(x): x is a fleegle 1. “All lions are fierce.”
2. “Some lions do not drink coffee.”
S(x): x is a snurd
3. “Some fierce creatures do not drink coffee.”
T(x): x is a thingamabob Here is one way to translate these statements to predicate logic.
Let P(x), Q(x), and R(x) be the propositional functions “x is a lion,”
“Some fleegles are thingamabobs.” “x is fierce,” and “x drinks coffee,” respectively.
1. X ( P ( X ) → Q ( X ) )
Solution: X ( F ( X ) T ( X ) ) 2. X ( P ( X ) R ( X ) )
3. X ( Q ( X ) R ( X ) )
Later we will see how to prove that the conclusion follows from
the premises
xyP ( x, y )
Answer:False For every x there is a y There is an x such that
for which P(x,y) is true. P(x,y) is false for every y.
2. x yP( x, y )
xyP ( x, y )
There is an x for which For every x there is a y
Answer:True P(x,y) is true for every y. for which P(x,y) is false.
3. x yP( x, y )
xyP ( x, y ) There is a pair x, y for P(x,y) is false for every
Answer:True which P(x,y) is true. pair x,y
yxP ( x, y )
4. x yP ( x, y )
Answer:True
1. Rewrite the statement to make the implied quantifiers and domains Example 2: “Siblinghood is symmetric.”
explicit: Solution: x y (S(x,y) → S(y,x))
“For every two integers, if these integers are both positive, then the Example 3: “Everybody loves somebody.”
sum of these integers is positive.”
Solution: x y L(x,y)
2. Introduce the variables x and y, and specify the domain, to obtain:
“For all positive integers x and y, x + y is positive.” Example 4: “There is someone who is loved by everyone.”
Solution: y x L(x,y)
3. The result is:
Example 5: “There is someone who loves someone.”
xy ( ( x 0 ) ( y 0 ) ) → ( x + y 0 ) Solution: x y L(x,y)
Example 6: “Everyone loves himself”
where the domain of both variables consists of all integers
Solution: x L(x,x)
3. Then the statement can be expressed as: Part 3: Can you translate the result back into English?
Solution:
waf ( P ( w, f ) Q ( f , a ) ) “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”
Some Questions about Quantifiers
(optional)
Can you switch the order of quantifiers?
• Is this a valid equivalence? xyP ( x, y ) yxP ( x, y )
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? xyP ( x, y ) yxP ( x, y )
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? x ( P ( x ) Q ( x ) ) xP ( x ) xQ ( x )
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).
• Is this a valid equivalence? x ( P ( x ) → Q ( x ) ) xP ( x ) → xQ ( x )
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.