Predicate Logic Lecture Notes
Predicate Logic Lecture Notes
Example: Let P(x) denote the statement “x > 3.” What are the truth values
of P(4) and P(2)?
Solution: We obtain the statement P(4) by setting x = 4 in the statement
Page 1 of 19
“x > 3.” Hence, P(4), which is the statement “4 > 3,” is true. However, P(2),
which is the statement “2 > 3,”is false.
Example: Let P(x) be the predicate “x2 > x” with domain the set R of all real
numbers. Write P(2), P( 1/2 ), and P(−1/2 ), and indicate which of these
statements are true and which are false.
Example: Let Q(x, y) denote the statement “x = y + 3.” What are the truth
values of the propositions
a) Q(1, 2)
b) Q(3, 0)?
Solution: To obtain 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.
The statement Q(3, 0) is the proposition “3 = 0 + 3,” which is true.
Example: Let R(x, y, z) denote the statement` ‘x + y = z.” When values are
assigned to the variables x, y, and z, this statement has a truth value.
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
Page 2 of 19
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.
Also note that R(0, 0, 1), which is the statement “0 + 0 = 1,” is false.
Definition
If P(x) is a predicate and x has domain D, the truth set of P(x) is the set of
all elements of D that make P(x) true when they are substituted for x. The
truth set of P(x) is denoted {x ∈ D | P(x)}.
Example: Let Q(n) be the predicate “n is a factor of 8.” Find the truth set of
Q(n) if
a. the domain of n is the set Z+ of all positive integers
b. the domain of n is the set Z of all integers.
Solution
a. The truth set is {1, 2, 4, 8} because these are exactly the positive integers
that divide 8 evenly.
b. The truth set is {1, 2, 4, 8,−1,−2,−4,−8} because the negative integers−1,−2,−
4, and −8 also divide into 8 without leaving a remainder.
Page 3 of 19
Quantifiers
When the variables in a propositional function are assigned values, the
resulting statement becomes a proposition with a certain truth value.
However, there is another important way, called quantification, to create a
proposition from a propositional function. Quantification expresses
the extent to which a predicate is true over a range of elements. In English,
the words all, some, many, none, and few are used in quantifications.
The Universal Quantifier
The universal quantification of P(x) is the statement
“P(x) for all values of x in the domain.”
The notation ∀xP(x) denotes the universal quantification of P(x).
Here ∀ is called the universal quantifier.
We read ∀xP(x) as “for all x P(x)” or “for every x P(x).”
Some other expressions that can be used instead of for all are
for arbitrary, for any, for each, and given any.
An element for which P(x) is false is called a counterexample of ∀xP(x).
Page 4 of 19
Solution
Check that “x2 ≥ x” is true for each individual x in D.
12 ≥ 1, 22 ≥ 2, 32 ≥ 3, 42 ≥ 4, 52 ≥ 5.
Hence “∀x ∈ D, x2 ≥ x” is true.
The technique used to show the truth of the universal statement in this
Example is called the method of exhaustion. It consists of showing the
truth of the predicate separately for each individual element of the domain.
(The idea is to exhaust the possibilities before you exhaust yourself!) This
method can, in theory, be used whenever the domain of the predicate
variable is finite.
Example: Consider the statement ∀x ∈ R, x2 ≥ x.
Find a counterexample to show that this statement is false.
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?
Solution: Because P(x) is true for all real numbers x, the quantification
∀xP(x) is true.
Page 5 of 19
Example Let Q(x) be the statement “x < 2.” What is the truth value of the
quantification ∀xQ(x), where the domain consists of all real numbers?
Solution: Q(x) is not true for every real number x, because, for instance,
Q(3) is false. That is,x = 3 is a counterexample for the statement ∀xQ(x).
Thus ∀xQ(x)is false.
Example: Suppose that P(x) is “x2 > 0.” To show that the statement ∀xP(x)
is false where the universe of discourse consists of all integers, we give a
counterexample. We see that x = 0 is a counterexample because x2 = 0 when
x = 0, so that x2 is not greater than 0 when x = 0.
Page 6 of 19
Example:
Page 7 of 19
Besides the phrase “there exists,”we can also express existential
quantification in many other ways, such as by using the words:
there is a, we can find a, there is, at least one, for some, for at least one.
Example: Let P(x) denote the statement “x > 3.” What is the truth value of
the quantification ∃xP(x), where the domain consists of all real numbers?
Solution: Because “x > 3” is sometimes true—for instance, when x = 4—the
existential quantification of P(x), which is ∃xP(x), is true.
Example: Let Q(x) denote the statement “x = x + 1.”What is the truth value
of the quantification ∃xQ(x), where the domain consists of all real
numbers?
Solution: Because Q(x) is false for every real number x, the existential
quantification of Q(x), which is ∃xQ(x), is false.
Example: Consider the statement ∃m ∈ Z+ such that m2 = m.
Show that this statement is true.
Solution: Observe that 12 = 1. Thus “m2 = m” is true for at least one integer
m. Hence “∃m ∈ Z such that m2 = m” is true.
Example: Let E = {5, 6, 7, 8} and consider the statement ∃m ∈ E such that
m2 = m. Show that this statement is false.
Solution: Note that m2 = m is not true for any integers m from 5 through 8:
52 = 25 ≠ 5, 62 = 36 ≠6, 72 = 49 ≠7, 82 = 64 ≠ 8.
Thus “∃m ∈ E such that m2 = m” is false.
Page 8 of 19
The Existential Quantifier and the connective OR
When all elements in the domain can be listed—say, x1, x2, . . . , xn—the
existential quantification ∃xP(x) is the same as the disjunction
P(x1) ∨ P(x2) ∨ · · · ∨ P(xn), 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
“x2 > 10” and the universe of discourse consists of the positive integers not
exceeding 4?
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.
Solution:
a. All real numbers have nonnegative squares.
Page 9 of 19
Or: Every real number has a nonnegative square.
Or: Any real number has a nonnegative square.
Or: The square of each real number is nonnegative.
b. All real numbers have squares that are not equal to −1.
Or: No real numbers have squares equal to −1.
(The words none are or no . . . are are equivalent to the words all are not.)
Precedence of Quantifiers
The quantifiers ∀ and ∃ have higher precedence than all logical operators
from propositional logic. For example, ∀xP(x) ∨ Q(x) is the disjunction of
∀xP(x) and Q(x). In other words, it means (∀xP(x)) ∨ Q(x) rather than
∀x(P(x) ∨ Q(x)).
Page 11 of 19
Binding Variables
When a quantifier is used on the variable x, we say that this occurrence of
the variable is bound.
An occurrence of a variable that is not bound by a quantifier or set equal to
a particular value is said to be free. All the variables that occur in a
propositional function must be bound or set equal to a particular value to
turn it into a proposition. This can be done using a combination of
universal quantifiers, existential quantifiers, and value assignments.
The part of a logical expression to which a quantifier is applied is called the
scope of this quantifier. Consequently, a variable is free if it is outside the
scope of all quantifiers in the formula that specify this variable.
Page 12 of 19
Universal Conditional Statements
A reasonable argument can be made that the most important form of
statement in mathematics is the universal conditional statement:
∀x, if P(x) then Q(x).
Example :
Rewrite the following statement informally, without quantifiers or
variables. ∀x ∈ R, if x > 2 then x2 > 4.
Solution: If a real number is greater than 2 then its square is greater than 4.
Or: Whenever a real number is greater than 2, its square is greater than 4.
Or: The square of any real number greater than 2 is greater than 4.
Or: The squares of all real numbers greater than 2 are greater than 4.
Example:
Rewrite each of the following statements in the form
∀ , if…………. then………… .
a. If a real number is an integer, then it is a rational number.
b. All bytes have eight bits.
c. No fire trucks are green.
Solution
a. ∀ real numbers x, if x is an integer, then x is a rational number.
Or: ∀x ∈ R, if x ∈ Z then x ∈ Q.
b. ∀x, if x is a byte, then x has eight bits.
c. ∀x, if x is a fire truck, then x is not green.
Page 13 of 19
Notation
Let P(x) and Q(x) be predicates and suppose the common domain of x is D.
• The notation P(x) ⇒ Q (x) means that every element in the truth set of
P(x) is in the truth set of Q(x), or, equivalently, ∀x, P(x) → Q(x).
• The notation P(x) ⇔ Q (x) means that P(x) and Q(x) have identical truth
sets, or, equivalently, ∀x, P(x) ↔ Q(x).
Example: Let
Q(n) be “n is a factor of 8,”
R(n) be “n is a factor of 4,”
S(n) be “n < 5 and n ≠ 3,”
and suppose the domain of n is Z+, the set of positive integers. Use the ⇒
and ⇔ symbols to indicate true relationships among Q(n), R(n), and S(n).
Solution
1. The truth set of Q(n) is {1, 2, 4, 8} when the domain of n is Z+.
By similar reasoning the truth set of R(n) is {1, 2, 4}.
Thus it is true that every element in the truth set of R(n) is in the truth set of
Q(n), or, equivalently, ∀n in Z+ , R(n) → Q(n).
So R(n) ⇒ Q(n), or, equivalently n is a factor of 4 ⇒ n is a factor of 8.
2. The truth set of S(n) is {1, 2, 4}, which is identical to the truth set of R(n),
or, equivalently,
∀n in Z+ , R(n) ↔ S(n). So R(n) ⇔ S(n), or, equivalently,
n is a factor of 4 ⇔ n < 5 and n ≠3.
Page 14 of 19
Moreover, since every element in the truth set of S(n) is in the truth set of
Q(n), or, equivalently,
∀n in Z+, S(n) → Q(n), then S(n) ⇒ Q(n), or, equivalently,
n < 5 and n ≠ 3 ⇒ n is a factor of 8.
Page 15 of 19
Example:
Write formal negations for the following statements:
a. ∀ primes p, p is odd.
b. ∃ a triangle T such that the sum of the angles of T equals 200◦.
Solution
a. By applying the rule for the negation of a ∀ statement, you can see that
the answer is
∃a prime p such that p is not odd.
b. By applying the rule for the negation of a ∃ statement, you can see that
the answer is
∀ triangles T, the sum of the angles of T does not equal 200◦
Example :
Rewrite the following statement formally. Then write formal and informal
negations.
No politicians are honest.
Solution Formal version: ∀ politicians x, x is not honest.
Formal negation: ∃ a politician x such that x is honest.
Informal negation: Some politicians are honest.
.
Negations of Universal Conditional Statements
By definition of the negation of a for all statement,
∼(∀x, P(x) → Q(x)) ≡ ∃x such that ∼(P(x) → Q(x)).
But the negation of an if-then statement is logically equivalent to an and
statement. More precisely,
Page 16 of 19
∼(P(x) → Q(x)) ≡ P(x) ∧ ∼Q(x).
Substituting we get
∼(∀x, P(x) → Q(x)) ≡ ∃x such that (P(x)∧ ∼Q(x)).
Written less symbolically, this becomes
∼(∀x, if P(x) then Q(x)) ≡ ∃x such that P(x) and ∼Q(x).
Example :
Write a formal negation for statement (a) and an informal negation for
statement (b).
a. ∀ people p, if p is blond then p has blue eyes.
b. If a computer program has more than 100,000 lines, then it contains a
bug.
Solution
a. ∃ a person p such that p is blond and p does not have blue eyes.
b. There is at least one computer program that has more than 100,000 lines
and does not contain a bug.
Page 17 of 19
Example: Write a formal and an informal contrapositive, converse, and
inverse for the following statement:
If a real number is greater than 2, then its square is greater than 4.
Solution The formal version of this statement is
∀x ∈ R, if x > 2 then x2 > 4.
Contrapositive: ∀x ∈ R, if x2 ≤ 4 then x ≤ 2.
Or: If the square of a real number is less than or equal to 4, then the number
is less than or equal to 2.
Converse: ∀x ∈ R, if x2 > 4 then x > 2.
Or: If the square of a real number is greater than 4, then the number is
greater than 2.
Inverse: ∀x ∈ R, if x ≤ 2 then x2 ≤ 4.
Or: If a real number is less than or equal to 2, then the square of the number
is less than or equal to 4.
Note that in solving this example, we have used the equivalence of “x ≯ a”
and “x ≤ a” for all real numbers x and a.
Note that:
Page 18 of 19
Example: Rewrite the following statements as quantified conditional
statements. Do not use the word necessary or sufficient.
a. Squareness is a sufficient condition for rectangularity.
b. Being at least 35 years old is a necessary condition for being President of
the United States.
Solution
a. A formal version of the statement is
∀x, if x is a square, then x is a rectangle.
Or, in informal language:
If a figure is a square, then it is a rectangle.
Page 19 of 19