Notes Predicate Logic
Notes Predicate Logic
R(3,4,7)
R(x, 3, z)
Q(3,4,7)
Q(x, 3, z)
Examples of Propositional
Functions
Let “x + y = z” be denoted by R(x, y, z) and U (for all three variables) be
the integers. Find these truth values:
R(2,-1,5)
Solution: F
R(3,4,7)
Solution: T
R(x, 3, z)
Solution: Not a Proposition
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)
P(3) ∧ P -1)
P(3) → P -1)
P(-3) → P -1)
Expressions with variables are not propositions and
therefore do not have truth values. For example,
P(3) ∧ P y)
P(x) → P y)
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)
NOTE: instead of specifying values of variables, one can convert
a propositional function into a proposition using quantifiers (see next slide)
Quantifiers Charles Peirce (1839-1914)
Examples:
1) If P(x) denotes “x > 0” and U is the integers, then
proposition ∀x P(x) is false.
2) If P(x) denotes “x > 0” and U is the positive integers, then
proposition ∀x P(x) is true.
3) If P(x) denotes “x is even” and U is the integers, then
proposition ∀ x P(x) is false.
Existential Quantifier ∃
∃x P(x) is read as “for some x, P(x)”, or “there is an x such
that P(x),” or “there exists x such that P(x),” or “for at least
one x, P(x).”
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.
2. If P(x) denotes “x < 0” and U is the positive integers, then
proposition ∃x P(x) is false.
3. If P(x) denotes “x is even” and U is the integers, then
proposition ∃x P(x) is true.
Thinking about Quantifiers
When the domain (of variable) is finite, we can think of quantification
as looping through the elements of the domain.
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 ?, and ∀ x P x) is ?.
2. If U is the negative integers and P(x) is the statement
“x < 2”, then ∃x P x) is ?, and ∀ x P x) is ?.
3. If U consists of 3, 4, and 5, and P(x) is the statement
“x > 2”, then ∃x P x) is ?, and ∀ x P x) is ? . But if P(x) is
the statement “x < 2”, then ∃x P x) is ?, and ∀ x P x) is ?
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 all integers and P(x) is the statement “x < 2”,
then ∃x P x) is true, but ∀ x P x) is false.
1. 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.
2. 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) and
∀ x P x) are false.
Precedence of Quantifiers
The quantifiers ∀ and ∃ have higher precedence than
all the logical operators.
For example, ∀x P x) ∨ Q x) means ∀x P x))∨ Q x)
∀x P x) ∨ Q x)) means something different.
Unfortunately, often people write ∀x P x) ∨ Q x) when
they mean ∀ x P x) ∨ Q x)).
Translating from English to Logic
Example 1: Translate the following sentence into predicate
logic: “Every student in this class has taken a course in Java.”
Translating from English to Logic
Example 1: 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)).
Example: ∀x ¬¬S x) ≡ ∀x S x)
Thinking about Quantifiers as
Conjunctions and Disjunctions
If the domain is finite, a universally quantified proposition is
equivalent to a conjunction of propositions without quantifiers
and an existentially quantified proposition is equivalent to a
disjunction of propositions without quantifiers.
If U consists of the integers 1,2, and 3:
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 J x)
“Every student in your class has taken a course in Java.”
Here J x) is “x has taken a course in Java” and
the domain is students in your class.
Negating the original statement gives “It is not the case
that every student in your class has taken Java.” This
implies that “There is a student in your class who has
not taken Java.”
Symbolically ¬∀x J x) and ∃x ¬J x) are equivalent
Negating Quantified Expressions
(continued)
Now Consider ∃ x J x)
“There is a student in this class who has taken a course in Java.”
Where J x) is “x has taken a course in Java.”
Negating the original statement gives “It is not the case
that there is a student in this class who has taken Java.”
This implies that “Every student in this class has not taken
Java”
Symbolically ¬∃ x J x) and ∀ x ¬J x) are equivalent
De Morgan’s Laws for Quantifiers
The rules for negating quantifiers are:
Solution: ∀x F x)
Translation (cont)
U = {fleegles, snurds, thingamabobs}
F(x): x is a fleegle
S(x): x is a snurd
T(x): x is a thingamabob
Translate “Nothing is a snurd.”
Translation (cont)
U = {fleegles, snurds, thingamabobs}
F(x): x is a fleegle
S(x): x is a snurd
T(x): x is a thingamabob
“Nothing is a snurd.”
Solution: ∃x F x) ∧ T x))
Translation (cont)
U = {fleegles, snurds, thingamabobs}
F(x): x is a fleegle
S(x): x is a snurd
T(x): x is a thingamabob
Translate “No snurd is a thingamabob.”
Translation (cont)
U = {fleegles, snurds, thingamabobs}
F(x): x is a fleegle
S(x): x is a snurd
T(x): x is a thingamabob
“No snurd is a thingamabob.”
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 ∀x ∀yP x,y) and
∀y ∀xP x,y) have the same truth value.
2. Let Q x,y) be the statement “x + y = 0.” Assume that
U is the real numbers. Then ∀x ∃yP x,y) is ?, but
∃y ∀xP x,y) is ?.
Order of Quantifiers
Examples:
1. Let P x,y) be the statement “x + y = y + x.” Assume
that U is the real numbers. Then ∀x ∀yP x,y) and
∀y ∀xP x,y) have the same truth value.
2. Let Q x,y) be the statement “x + y = 0.” Assume that
U is the real numbers. Then ∀x ∃yP x,y) is true, but
∃y ∀xP x,y) is false.
Questions on Order of Quantifiers
Example 1: Let U be the real numbers,
Define P(x,y) : x ∙ y = 0
What is the truth value of the following:
1. ∀x∀yP x,y)
2. ∀x∃yP x,y)
3. ∃x∀y P x,y)
4. ∃x ∃ y P x,y)
Questions on Order of Quantifiers
Example 1: Let U be the real numbers,
Define P(x,y) : x ∙ y = 0
What is the truth value of the following:
1. ∀x∀yP x,y)
Answer: False
2. ∀x∃yP x,y)
Answer: True
3. ∃x∀y P x,y)
Answer: True
4. ∃x ∃ y P x,y)
Answer: True
Questions on Order of Quantifiers
Example 2: Let U be the real numbers,
Define P(x,y) : x / y = 1
What is the truth value of the following:
1. ∀x∀yP x,y)
2. ∀x∃yP x,y)
3. ∃x∀y P x,y)
4. ∃x ∃ y P x,y)
Questions on Order of Quantifiers
Example 2: Let U be the real numbers,
Define P(x,y) : x / y = 1
What is the truth value of the following:
1. ∀x∀yP x,y)
Answer: False
2. ∀x∃yP x,y)
Answer: False
3. ∃x∀y P x,y)
Answer: False
4. ∃x ∃ y P x,y)
Answer: True
Quantifications of Two Variables
Statement A When A is true? When A is false? (¬A is true)
Use quantifiers to express the statement that “There does not exist a woman
who has taken a flight on every airline in the world.”
¬∃w ∀a ∃f P w,f ) ∧ Q f,a))
Now use De Morgan’s Laws to move the negation as far inwards as possible.
“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”
Questions on Translation from
English
Choose the obvious predicates and express in predicate logic.
Example 1: “Brothers are siblings.”