2 Chap1
2 Chap1
1
1.3 Predicates and Quantifiers
Predicates
Statements involving variables are neither true
nor false.
E.g. “x > 3”, “x = y + 3”, “x + y = z”
“x is greater than 3”
“x”: subject of the statement
“is greater than 3”: the predicate
We can denote the statement “x is greater than
3” by P(x), where P denotes the predicate and x
is the variable.
Once a value is assigned to the variable x, the
statement P(x) becomes a proposition and has a
truth value.
2
1.3 Predicates and Quantifiers
Example: Let P(x) denote the statement “x > 3.”
What are the truth values of P(4) and P(2)?
Solution: P(4) – “4 > 3”, true
P(3) – “2 > 3”, false
Example: Let Q(x,y) denote the statement “x = y
+ 3.” What are the truth values of the
propositions Q(1,2) and Q(3,0)?
Solution: Q(1,2) – “1 = 2 + 3” , false
Q(3,0) – “3 = 0 + 3”, true
3
1.3 Predicates and Quantifiers
Example: Let A(c,n) denote the statement “Computer c is
connected to network n”, where c is a variable
representing a computer and n is a variable representing a
network. Suppose that the computer MATH1 is connected
to network CAMPUS2, but not to network CAMPUS1.
What are the values of A(MATH1, CAMPUS1) and
A(MATH1, CAMPUS2)?
Solution: A(MATH1, CAMPUS1) – “MATH1 is connect to CAMPUS1”, false
A(MATH1, CAMPUS2) – “MATH1 is connect to CAMPUS2”, true
4
1.3 Predicates and Quantifiers
5
1.3 Predicates and Quantifiers
Example:
“ if x > 0 then x:= x + 1”
When the statement is encountered, the
value if x is inserted into P(x).
If P(x) is true, x is increased by 1.
If P(x) is false, x is not changed.
6
1.3 Predicates and Quantifiers
Quantifiers
Quantification: express the extent to which
a predicate is true over a range of
elements.
Universal quantification: a predicate is
true for every element under consideration
Existential quantification: a predicate is
true for one or more element under
consideration
A domain must be specified.
7
1.3 Predicates and Quantifiers
DEFINITION 1
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 xP(x)” or “for
every xP(x).” An element for which P(x) is false is called a counterexample
of xP(x).
10
1.3 Predicates and Quantifiers
DEFINITION 2
The existential quantification of P(x) is the statement
“There exists 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 called the Existential Quantifier.
• The existential quantification xP(x) is read as
“There is an x such that P(x),” or
“There is at least one x such that P(x),” or
“For some x, P(x).”
11
1.3 Predicates and Quantifiers
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: “x > 3” is sometimes true – for instance when
x = 4. The existential quantification is true.
xP(x) is false if and only if P(x) is false for every element
of the domain.
Example: Let Q(x) denote the statement “x = x + 1”. What
is the true value of the quantification xQ(x), where the
domain consists for all real numbers?
Solution: Q(x) is false for every real number. The existential
quantification is false. 12
1.3 Predicates and Quantifiers
If the domain is empty, xQ(x) is false because there can
be no element in the domain for which Q(x) is true.
The existential quantification xP(x) is the same as the
disjunction P(x1) V P(x2) V … VP(xn)
Quantifiers
Statement When True? When False?
13
Uniqueness Quantifier
• !x P(x) means that P(x) is true for one and only one x
in the universe of discourse.
• This is commonly expressed in English in the following
equivalent ways:
“There is a unique x such that P(x).”
“There is one and only one x such that P(x)”
14
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:
15
Precedence of Quantifiers
The quantifiers and have higher
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.”
Solution:
x J(x)
as
equivalent
Negating Quantified Expressions
(continued)
Now Consider x J(x)
“There is a student in this class who has taken a
are equivalent
De Morgan’s Laws for Quantifiers
The rules for negating quantifiers are:
x (S(x) ∧ M(x))
2.“Every student in this class has visited
Canada or Mexico.”
x (S(x)→ (M(x)∨C(x)))
Solution: Add C(x) denoting “x has visited Canada.”
Lewis Carroll Example
Charles Lutwidge
Dodgson
The first two are called premises and(AKA
theLewis
third is
Caroll)
called the conclusion. (1832-1898)
1. “All lions are fierce.”
2. “Some lions do not drink coffee.”
3. “Some fierce creatures do not drink coffee.”
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,” “x is fierce,”
1. x (P(x)→ Q(x))
and “x drinks coffee,” respectively.
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.
Nested Quantifiers
Nested quantifiers are often necessary to express
the meaning of sentences in English as well as
important concepts in computer science and
mathematics.
x y(x + y = 0)
Example: “Every real number has an inverse” is
:
At each step, loop through the values for y.
If for some pair of x andy, P(x,y) is false, then x yP(x,y) is false
through each x.
To see if x yP(x,y) is true, loop through the values of x:
At each step, loop through the values for y.
The inner loop ends when a pair x and y is found such that
P(x, y) is true.
If no y is found such that P(x, y) is true the outer loop
terminates as x yP(x,y) has been shown to be false.
x y P(x,y) is true if the outer loop ends after stepping
through each x.
If the domains of the variables are infinite, then this
process can not actually be carried out.
Order of Quantifiers
3. xy P(x,y)
Answer: True
4. x y P(x,y)
Answer: True
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. xyP(x,y)
Answer: False
2. xyP(x,y)
3. xy P(x,y)
Answer: False
4. x y P(x,y)
Answer: False
Answer: True
Quantifications of Two Variables
w a f (P(w,f ) ∧ Q(f,a))
3. Then the statement can be expressed as:
Questions on Translation from English
Solution: x L(x,x)
Rules of Inference
Revisiting the Socrates Example
We have the two premises:
“All men are mortal.”
“Socrates is a man.”
And the conclusion:
“Socrates is mortal.”
How do we get the conclusion from the
premises?
The Argument
We can express the premises (above the line)
and the conclusion (below the line) in
predicate logic as an argument:
(p1 ∧ p2 ∧ … ∧ pn ) → q is a tautology.
then
(p ∧ (p →q)) → q
Corresponding Tautology:
Example:
Let p be “It is snowing.”
Let q be “I will study discrete math.”
(¬q∧(p →q))→¬p
Corresponding Tautology:
Example:
Let p be “it is snowing.”
Let q be “I will study discrete math.”
Example:
Let p be “it snows.”
Let q be “I will study discrete math.”
Let r be “I will get an A.”
(¬p∧(p ∨q))→q
Corresponding Tautology:
Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”
p →(p ∨q)
Corresponding Tautology:
Example:
Let p be “I will study discrete math.”
Let q be “I will visit Las Vegas.”
(p∧q) →p
Corresponding Tautology:
Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”
Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”
p → q is true as well.
Trivial Proof: If we know q is true, then
p → q is true as well.
Vacuous Proof: If we know p is false then
+ 1,
where r = 2k2 + 2k , an integer.
where v = pu + qt
w = qu ≠ 0
Thus the sum is rational.
p→q
Proving Conditional Statements:
n2 = 4k2 = 2 (2k2)
and n2 is even(i.e., not odd).
We have shown that if n is an even integer, then
n2 is even. Therefore by contraposition, for an
integer n, if n2 is odd, then n is odd.
Proving Conditional Statements: p → q
irrational.
Solution: Suppose √2 is rational. Then there exists integers a
and b with √2 = a/b, where b≠ 0 and a and b have no common
factors (see Chapter 4). Then
“Proof” that 1 = 2