Chapter 2 - Predicate
Chapter 2 - Predicate
Chapter 2 - Predicate
In this section we will introduce a more powerful type of logic called predicate Example 3 : Let R(x, y, z) denote the statement ”x + y = z”. What are the truth
logic. We will see how predicate logic can be used to express the meaning of a wide values of the propositions R(1, 2, 3) and R(0, 0, 1) ?
range of statements in mathematics and computer science in ways that permit us to
reason and explore relationships between objects. In general, a statement involving the n variables x1 , x2 , . . . , xn can be denoted by
P (x1 , x2 , . . . , xn ).
1
fications. We will focus on two types of quantification here : universal quantification, Example : What is the truth value of ∀xP (x), where P (x) is the statement
which tells us that a predicate is true for every element under consideration, and ”x2 < 10” and the domain consists of the positive integers not exceeding 4 ?
existential quantification, which tells us that there is one or more element under Solution : The statement ∀xP (x) is the same as the conjunction P (1) ∧ P (2) ∧ P (3) ∧
consideration for which the predicate is true. The area of logic that deals with pre- P (4).
dicates and quantifiers is called the predicate calculus.
Definition 3. The existential quantification of P (x) is the proposition : ”There exists
Definition 2. The universal quantification of P (x) is the statement : an element x in the domain such that P (x).”
We use the notation ∃xP (x) for the existential quantification of P (x). Here ∃ is
”P (x) for all values of x in the domain”
called the existential quantifier.
The notation ∀xP (x) denotes the universal quantification of P (x). Here ∀ is called A domain must always be specified when a statement ∃xP (x) is used. Furthermore,
the universal quantifier.We read ∀xP (x) as ”for all xP (x)” or ”for every xP (x)”. the meaning of ∃xP (x changes when the domain changes. Without specifying the
An element for which P (x) is false is called a counterexample of ∀xP (x). domain, the statement ∃xP (x) has no meaning.
Remarks : Besides the phrase ”there exists” we can also express existential quantification in
1. The domain (or also the domain of discourse) specifies all the possible values many other ways, such as by using the words ”for some”, ”for at least one” or ”there
of the variable x is”. The existential quantification ∃xP (x) is read as ”There is an x such that P(x)”,
”There is at least one x such that P(x)”, or ”For some xP (x)”.
2. If the domain is empty, the ∀xP (x) is True for any propositional function P (x)
because there are no elements x in the domain for which P () is false. Example :
A statement ∀xP (x) is false, where P (x) is a propositional function, if and only if Let P (x) denote the statement ”x > 3”. What is the truth value of the quantification
P (x) is not always true when x is in the domain. One way to show that P (x) is not ∃xP (x), where the domain consists of all real numbers ?
always true when x is in the domain is to find a counterexample to the statement Solution : Because ”x > 3” is sometimes true -for instance, when x = 4 - the
∀xP (x). Note that a single counterexample is all we need to establish that ∀xP (x) existential quantification of P (x), which is ∃xP (x), is true.
is false.
Observe that the statement ∃xP (x) is false if and only if there is no element x in the
Examples domain for which P (x) is true. That is, ∃xP (x) is false if and only if P (x) is false for
every element of the domain.
1. Let P (x) be the statement ”x + 1 > x.” What is the truth value of the quanti- Example : Let Q(x) denote the statement ”x = x + 1”. What is the truth value of
fication ∀xP (x), where the domain consists of all real numbers ? the quantification ∃xQ(x), where the domain consists of all real numbers ?
Solution : Because P (x) is true for all real numbers x, the quantification ∀xP (x) Solution : Because Q(x) is false for every real number x, the existential quantification
is true. of Q(x), which is ∃xQ(x), is false.
2. Let Q(x) be the statement ”x < 2”. What is the truth value of the quantification
Remark :
∀xQ(x), where the domain consists of all real numbers ?
If the domain is empty, then ∃xQ(x) is false whenever Q(x) is a propositional
Solution : Q(x) is not true for every real number x, because, for instance, Q(3)
function because when the domain is empty, there can be no element x in the
is false. That is, x = 3 is a counterexample for the statement ∀xQ(x). Thus
domain for which Q(x) is true.
∀xQ(x) is false.
When all elements in the domain can be listed - say, x1 , x2 , . . . , xn - the existential
3. Suppose that P (x) is ”x2 > 0”. To show that the statement ∀xP (x) is false quantification ∃xP (x) is the same as the disjunction P (x1 ) ∨ P (x2 ) ∨ . . . ∨ P (xn ),
where the universe of discourse consists of all integers, we give a counte- because this disjunction is true if and only if at least one of P (x1 ), P (x2 ), . . . , P (xn )
rexample. We see that x = 0 is a counterexample because x2 = 0 when x = 0, is true.
so that x2 is not greater than 0 when x = 0.
When all the elements in the domain can be listed - say, x1 , x2 , . . . , xn , it follows that Example :
the universal quantification ∀xP (x) is the same as the conjunction P (x1 ) ∧ P (x2 ) ∧ What is the truth value of ∃xP (x) , where P (x) is the statement ”x2 > 10” and the
. . . ∧ P (xn ), because this conjunction is true if and only if P (x1 ), P (x2 ), ..., P (xn ) are universe of discourse consists of the positive integers not exceeding 4 ?
all true. Solution : Because the domain is {1, 2, 3, 4}, the proposition ∃xP (x) is the same as
2
the disjunction P (1) ∨ P (2) ∨ P (3) ∨ P (4). Statement When True ? When False ?
Because P (4), which is the statement ”42 > 10” is true, it follows that ∃xP (x) is ∀xP (x) P (x) is true for There is an x for
true. every x which P (x) is false.
∃xP (x) There is an x for P (x) is false for
which P (x) is true every x.
Precedence of Quantifiers Table 1 – Meaning of the universal quantifier
The quantifiers ∀ and ∃ have higher precedence than all logical operators from pro-
positional calculus. For example, ∀xP (x)∨Q(x) is the disjunction of ∀xP (x)andQ(x). 4 Translating from English into Logical Expres-
In other words, it means (∀xP (x)) ∨ Q(x) rather than ∀x(P (x) ∨ Q(x)). sions
Translating sentences in English (or other natural languages) into logical expres-
sions is a crucial task in mathematics, logic programming, artificial intelligence,
Binding Variables software engineering, and many other disciplines.
When a quantifier is used on the variable x, we say that this occurrence of the Example 1 :
variable is bound. An occurrence of a variable that is not bound by a quantifier or Express the statement ”Every student in this class has studied calculus” using
set equal to a particular value is said to be free. All the variables that occur in a predicates and quantifiers.
propositional function must be bound or set equal to a particular value to turn it Solution : First, we rewrite the statement so that we can clearly identify the
into a proposition. This can be done using a combination of universal quantifiers, appropriate quantifiers to use. Doing so, we obtain : ”For every student in this class,
existential quantifiers, and value assignments. that student has studied calculus.
Next, we introduce a variable x so that our statement becomes ”For every student
The part of a logical expression to which a quantifier is applied is called the scope x in this class, x has studied calculus.” Continuing, we introduce C(x), which is the
of this quantifier. Consequently, a variable is free if it is outside the scope of all statement ”x has studied calculus.”
quantifiers in the formula that specify this variable. Consequently, if the domain for x consists of the students in the class, we can
translate our statement as : ∀xC(x).
Examples :
If we change the domain to consist of all people, we will need to express our
statement as ”For every person x, if person x is a student in this class then x has
— In the statement ∃x(x + y = 1), the variable x is bound by the existential quan- studied calculus.”
tification ∃x, but the variable y is free because it is not bound by a quantifier If S(x) represents the statement that ”person x is in this class”, we see that our
and no value is assigned to this variable. This illustrates that in the statement statement can be expressed as : ∀x(S(x) → C(x)).
∃x(x + y = 1), x is bound, but y is free.
— In the statement ∃x(P (x) ∧ Q(x)) ∨ ∀xR(x), all variables are bound. The scope Attention : Our statement cannot be expressed as ∀x(S(x) ∧ C(x)) because this
of the first quantifier, ∃x, is the expression P (x) ∧ Q(x) because ∃x is applied statement says that all people are students in this class and have studied calculus !.
only to P (x) ∧ Q(x), and not to the rest of the statement. Similarly, the scope
of the second quantifier, ∀x, is the expression R(x). That is, the existential Example 2 :
quantifier binds the variable x in P (x) ∧ Q(x) and the universal quantifier ∀x Express the statements ”Some student in this class has visited Mexico” and ”Every
binds the variable x in R(x). Observe that we could have written our statement student in this class has visited either Canada or Mexico” using predicates and
using two different variables x and y, as ∃x(P (x) ∧ Q(x)) ∨ ∀yR(y), because the quantifiers.
scopes of the two quantifiers do not overlap.
The meaning of the universal quantifier is summarized in table 1. Solution : The statement ”Some student in this class has visited Mexico” means
3
that ”There is a student in this class with the property that the student has visited 2. ¬∃xP (x) ≡ ∀x¬P (x)
Mexico.” We can introduce a variable x, so that our statement becomes ”There is a
student x in this class having the property that x has visited Mexico.” Example :
We introduce M (x), which is the statement ”x has visited Mexico.” If the domain Consider the negation of the statement ”Every student in your class has taken a
for x consists of the students in this class, we can translate this first statement as course in calculus”.
∃xM (x). This statement can be expressed as : ∀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.
However, if we are interested in people other than those in this class, we look at The negation of this statement is ”It is not the case that every student in your
the statement a little differently. Our statement can be expressed as ”There is a class has taken a course in calculus”. This is equivalent to ”There is a student in
person x having the properties that x is a student in this class and x has visited your class who has not taken a course in calculus”. And this is simply the exis-
Mexico.” tential quantification of the negation of the original propositional function : ∃x¬P (x).
In this case, the domain for the variable x consists of all people. We introduce S(x)
to represent ”x is a student in this class”. Our solution becomes ∃x(S(x) ∧ M (x)) Consider the proposition ”There is a student in this class who has taken a course
because the statement is that there is a person x who is a student in this class and in calculus”. This is the existential quantification ∃xQ(x), and the domain consists
who has visited Mexico. to students in your class.
Attention : The negation of this statement is the proposition ”It is not the case that there is
Our statement cannot be expressed as ∃x(S(x) → M (x)), which is true when there a student in this class who has taken a course in calculus”. This is equivalent to
is someone not in the class because, in that case, for such a person x, S(x) → M (x) ”Every student in this class has not taken calculus” which is just the universal
becomes either F → T or F → F , both of which are true. quantification of the negation of the original propositional function, or, phrased in
the language of quantifiers : ∀x¬Q(x).
Similarly consider : ”For every x in this class, x has the property that x has visited
Mexico or x has visited Canada.” Table 3 summarizes DeMorgan ’s Law.
We let C(x) be ”x has visited Canada”.
if the domain for x consists of the students in this class, this second statement can
Negation Equivalent State- When is Negation When is False
be expressed as ∃x(C(x) ∨ M (x)).
ment True ?
However, if the domain for x consists of all people, our statement can be expressed ¬∃xP (x) ∀x¬P (x) For every x, P (x) is There is an x for
as ”For every person x, if x is a student in this class, then x has visited Mexico false which P (x) is True
or x has visited Canada”. Thus the statement can be expressed as : ∀x(S(x) → ¬∀xP (x) ∃x¬P (x) There is an x for P (x) is True for
(C(x) ∨ M (x))). which P (x) is false every x
4
6.2 Exercise 2 : a y for which P (x, y) is true. The statement ∃x ∃y P (x, y) is false only if we
never hit an x for which we hit a y such that P (x, y) is true.
Express the following statement using quantifiers : ”All hummingbirds are richly
colored”, ”No large birds live on honey”, ”Birds that do not live on honey are dull
in color” and ”Hummingbirds are small. Statement When True ? When False ?
The domain consists of all birds, ∀x∀yP (x, y) P (x, y) is true for every There is a pair x, y for
or pair x, y. which P (x, y) is false.
∀y∀xP (x, y)
7 Nested Quantifiers ∀x∃yP (x, y) For every x, there is y for There is x for which
which P (x, y) is true P (x, y) is false for every y.
Definition 5. Two quantifiers are nested if one is within the scope of the other.
∃x∀yP (x, y) There is x for which For every x, there is y for
Example 1 : ∀x ∃y (x + y = 0). This statement means that for every real number P (x, y) is True for every y which P (x, y) is false
x, it exists a real number y such that x + y = 0. ∃x∃yP (x, y) There is a pair x, y for P (x, y) is fale for every
or which P (x, y) is true pair x, y.
Example 2 : Translate into English the statement : ∀x ∀y ((x > 0) ∧ (y < 0) −→ ∃y∃xP (x, y)
(xy < 0)) where the domain for both variables consists of all real numbers.
Table 3 – Quantifications of Two Variables.
This statement says that for every real number x and for every real number y, if
x > 0 and y < 0, then xy < 0. That is, this statement says that for real numbers x
and y, if x is positive and y is negative, then xy is negative. This can be stated more 7.1 Orders of Quantifiers
succinctly as ”The product of a positive real number and a negative real number is
Many mathematical statements involve multiple quantifications of propositional
always a negative real number.”
functions involving more than one variable. 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.
THINKING OF QUANTIFICATION AS LOOPS : In working with quanti-
Example 1 : Let P (x, y) be the statement ”x + y = y + x”. What are the truth
fications of more than one variable, it is sometimes helpful to think in terms of nested
values of the quantifications ∀x∀yP (x, y) and ∀y∀xP (x, y) where the domain for all
loops :
variables consists of all real numbers ?
1. To see whether ∀x ∀y P (x, y) is true, we loop through the values for x, and for
each x we loop through the values for y. If we find that P (x, y) is true for all The quantification ∀x∀yP (x, y) denotes the proposition ”For all real numbers x, for
values for x and y, we have determined that ∀x ∀y P (x, y) is true. If we ever hit all real numbers y, x + y = y + x. Because P (x, y) is true for all real numbers x and
a value x for which we hit a value y for which P (x, y) is false, we have shown y (it is the commutative law for addition).
that ∀x ∀y P (x, y) is false.
2. To determine whether ∀x ∃y P (x, y) is true, we loop through the values for x. Note that the statement ∀y∀xP (x, y) says ”For all real numbers y, for all real
For each x we loop through the values for y until we find a y for which P (x, y) numbers x, x + y = y + x.” This has the same meaning as the statement ”For all
is true. If for every x we hit such a y, then ∀x ∃y P (x, y) is true ; if for some x real numbers x, for all real numbers y, x + y = y + x.” That is, ∀x∀yP (x, y) and
we never hit such a y, then ∀x ∃y P (x, y) is false. ∀y∀xP (x, y) have the same meaning.
3. To see whether ∃ x ∀y P (x, y) is true, we loop through the values for x until Example 2 : Let Q(x, y) denote ”x + y = 0”. What are the truth values of the
we find an x for which P (x, y) is always true when we loop through all values quantifications ∃y∀xQ(x, y) and ∀x∃yQ(x, y) , where the domain for all variables
for y. Once we find such an x, we know that ∃ x ∀y P (x, y) is true. If we never consists of all real numbers ?
hit such an x, then we know that ∃ x ∀y P (x, y) is false. The quantification ∃y∀xQ(x, y) denotes the proposition ”There is a real number y
4. To see whether ∃x ∃y P (x, y) is true, we loop through the values for x, where such that for every real number x, Q(x, y). No matter what value of y is chosen,
for each x we loop through the values for y until we hit an x for which we hit there is only one value of x for which x + y = 0. Because there is no real number y
5
such that x + y = 0 for all real numbers x, the statement ∃y∀xQ(x, y) is false. 6. Some students eat orange.
The quantification ∀x∃yQ(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) 7. Harry does not eat banana.
is true.
Exercise 1 :
Let T (x, y) : ”x eats y”, w(X) :” x is wise” , H(x) :”x is strong”, C(X) :”y is
11. Some fruits are eaten by all students.
juicy”, R(y) :”y is red”. The domain for X the students = Jack, Mike, Harry and
Y domain are the fruits = Apple, Orange, Banana. Assume Jack eats Apple and
Banana. Mike eats all fruit and Harry eat oranges and apples. Also assume Mike and
Harry are wise and apple and orange are red. Convert from English to symbolic and
vice versa and find the truth for each. 12. All wise student eat all red fruits.
14. All neither wise nor strong students do not eat banana.
3. All students eat some fruits.
15. For all student x and all fruits y : if x is wise and y not red, then x does not
4. Some students eat all fruits. eat y.
5. Jack eats all fruits. 16. If a student either strong or not wise , then he eats some red juicy fruits.
6
17. There exists a not wise or strong student that eat all fruits. 28. ¬∀x, ∃y : ¬W (x) ∧ ¬H(x) −→ T (x, y).
18. Some fruits are eaten by all wise and strong students. 29. ∃x, ∃y : H(x) ∧ ¬C(y) ∧ T (x, y).
Exercise 2 :
22. Not all students are wise or strong.
P (x, y) :”x bites y” , B(x) :”x is black” ,F (x) ”x is furry”. G(x) :”x is grumpy”.
C(x) : ”x is clumsy”. the domain for x and y are all cats.
26. ∀x, ∀y : W (x) ∨ ¬R(y) −→ T (x, y). 4. Some black cats do not bite clumsy Fifi.
27. ∀x, ∃y : ¬W (x) −→ ¬T (x, y) ∧ C(y). 5. All non black grumpy cats bite all cats.
7
6. All non black cats bite all grumpy cats. 17. There is a non clumsy cat such that it bites some black cats.
7. All grumpy cats are bitten by all non black cats. 18. Some black grumpy cats bite all cats.
8. All cats are neither non black nor bite Catoo. 19. Some neither grumpy nor clumsy cats bite all either black or furry cats.
9. All cats are grumpy and bite all cats. 20. All neither grumpy nor clumsy cats are bitten by some either black or furry
cats.
10. All cats are not black or bite all furry cats .
21. Some neither grumpy nor clumsy cats do not bite all cats.
12. All grumpy cats bite some black cats. 23. ∀y : B() ∧ ¬C(y).
13. All cats do not bite some black cats. 24. P (F if i, Catoo) −→ G(F if i) ∨ B(Catoo).
14. Some cats bite the clumsy black Catoo . 25. ∃x : P (x, Catoo) ∧ B(x).
15. Some furry cats are not bitten by the non furry Fifi. 26. ∀x, ∀y : ¬B(x) ∧ ¬P (x, y).
16. Some not furry black cats bite some cats. 27. ∀x, ∀y : ¬B(x) −→ ¬P (x, y).
8
28. ∀x, ∀y : ¬P (x, y) −→ ¬B(x). 39. ∃x, ∃y : B(x) ∧ P (x, y) ∧ G(y).
9
3. ∀y ∈ R, ∃x ∈ R : y = 2x + 1 14. ∃x ∈ R, ∀y ∈ R : x − y = y.
x
4. ∃x ∈ R, ∃y ∈ R : (x − y = −9) ∧ (2x + y = 3). 15. ∃x, y ∈ Z : =x+y .
y
√
5. ∀y ∈ Z+ , ∃x ∈ Z+ : y = x + 2.
16. ∀x, y ∈ Z : x2 + y 2 > 0.
6. ∃a ∈ Z, ∀b ∈ Z : a + b = 2. x2 − 2y
17. ∀x ∈ Z, ∃y ∈ Z : = 1.
y2 + 1
r
x
7. ∃x ∈ R : √ is rational but not integer. √
2 18. ∃x ∈ Z, ∀y ∈ R : xy 2 = 0.
9. ∀n ∈ Z + , ∃t ∈ Q+ : t2 − n − 1 = 0. 20. ∀x ∈ Z, ∃y ∈ Z : xy = 1.
√
11. ∃x, y ∈ Z : x − y = y. 22. ∃x ∈ A : x2 − x = 0 where A= 0,1,2.
13. ∀x ∈ Z, ∃y ∈ Z : x − y = y. 24. ∀x ∈ Z, ∃y ∈ Z − : x2 − y 2 = 9.
10
25. ∃x ∈ R, ∀y ∈ R : y < 5 −→ y 2 − x2 ≥ 0.
26. ∀x ∈ Z : (x2 + 2x − 3 = 0) .
x
28. ∃m ∈ R, ∀x ∈ Z + : < m.
x+1
11