Professional Documents
Culture Documents
Predicate
Logic and
Quantifiers
CSE235
Predicate Logic and Quantifiers
Spring 2006
Introduction Notes
Predicate
Logic and
Consider the following statements:
Quantifiers
x > 3, x = y + 3, x+y =z
CSE235
“ |{z}
x is greater than 3”
| {z }
subject predicate
Predicate
Logic and
Quantifiers
To write in predicate logic:
CSE235
“ |{z}
x is greater than 3”
| {z }
subject predicate
Predicate
Logic and
Quantifiers
Definition
CSE235
A statement of the form P (x1 , x2 , . . . , xn ) is the value of the
propositional function P . Here, (x1 , x2 , . . . , xn ) is an n-tuple
and P is a predicate.
4/1
Predicate
Logic and
Quantifiers
CSE235
Example
Let Q(x, y, z) denote the statement “x2 + y 2 = z 2 ”. What is
the truth value of Q(3, 4, 5)? What is the truth value of
Q(2, 2, 3)? How many values of (x, y, z) make the predicate
true?
5/1
Predicate
Logic and
Quantifiers
CSE235
Example
Let Q(x, y, z) denote the statement “x2 + y 2 = z 2 ”. What is
the truth value of Q(3, 4, 5)? What is the truth value of
Q(2, 2, 3)? How many values of (x, y, z) make the predicate
true?
6/1
Universe of Discourse Notes
Predicate
Logic and
Quantifiers
CSE235
7/1
Predicate
Logic and
Quantifiers
CSE235
8/1
Quantifiers Notes
Introduction
Predicate
Logic and
Quantifiers
CSE235
9/1
Universal Quantifier Notes
Definition
Predicate
Logic and
Quantifiers
Definition
CSE235 The universal quantification of a predicate P (x) is the
proposition “P (x) is true for all values of x in the universe of
discourse” We use the notation
∀xP (x)
10 / 1
Predicate
Logic and Let P (x) be the predicate “x must take a discrete
Quantifiers
mathematics course” and let Q(x) be the predicate “x is a
CSE235
computer science student”.
The universe of discourse for both P (x) and Q(x) is all
UNL students.
Express the statement “Every computer science student
must take a discrete mathematics course”.
11 / 1
Predicate
Logic and Let P (x) be the predicate “x must take a discrete
Quantifiers
mathematics course” and let Q(x) be the predicate “x is a
CSE235
computer science student”.
The universe of discourse for both P (x) and Q(x) is all
UNL students.
Express the statement “Every computer science student
must take a discrete mathematics course”.
∀x(Q(x) → P (x))
12 / 1
Universal Quantifier Notes
Example I
Predicate
Logic and Let P (x) be the predicate “x must take a discrete
Quantifiers
mathematics course” and let Q(x) be the predicate “x is a
CSE235
computer science student”.
The universe of discourse for both P (x) and Q(x) is all
UNL students.
Express the statement “Every computer science student
must take a discrete mathematics course”.
∀x(Q(x) → P (x))
13 / 1
Predicate
Logic and Let P (x) be the predicate “x must take a discrete
Quantifiers
mathematics course” and let Q(x) be the predicate “x is a
CSE235
computer science student”.
The universe of discourse for both P (x) and Q(x) is all
UNL students.
Express the statement “Every computer science student
must take a discrete mathematics course”.
∀x(Q(x) → P (x))
14 / 1
Are these statements true or false?
Predicate
Logic and
Quantifiers
CSE235
Express the statement “for every x and for every y, x + y > 10”
15 / 1
Universal Quantifier Notes
Example II
Predicate
Logic and
Quantifiers
CSE235
Express the statement “for every x and for every y, x + y > 10”
Let P (x, y) be the statement x + y > 10 where the universe of
discourse for x, y is the set of integers.
16 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the statement “for every x and for every y, x + y > 10”
Let P (x, y) be the statement x + y > 10 where the universe of
discourse for x, y is the set of integers.
Answer:
∀x∀yP (x, y)
17 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the statement “for every x and for every y, x + y > 10”
Let P (x, y) be the statement x + y > 10 where the universe of
discourse for x, y is the set of integers.
Answer:
∀x∀yP (x, y)
∀x, yP (x, y)
18 / 1
Existential Quantifier Notes
Definition
Predicate
Logic and
Quantifiers
Definition
CSE235 The existential quantification of a predicate P (x) is the
proposition “There exists an x in the universe of discourse such
that P (x) is true.” We use the notation
∃xP (x)
19 / 1
Predicate
Logic and
Quantifiers
CSE235
∃x∃yP (x)
mean?
What universe(s) of discourse make it true?
20 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the statement “there exists a real solution to
ax2 + bx − c = 0”
21 / 1
Existential Quantifier Notes
Example II
Predicate
Logic and
Quantifiers
CSE235
Express the statement “there exists a real solution to
ax2 + bx − c = 0”
√
2
Let P (x) be the statement x = −b± 2a b −4ac
where the universe
of discourse for x is the set of reals. Note here that a, b, c are
all fixed constants.
22 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the statement “there exists a real solution to
ax2 + bx − c = 0”
√
2
Let P (x) be the statement x = −b± 2a b −4ac
where the universe
of discourse for x is the set of reals. Note here that a, b, c are
all fixed constants.
The statement can thus be expressed as
∃xP (x)
23 / 1
Predicate
Logic and
Quantifiers
CSE235
24 / 1
Existential Quantifier Notes
Example II Continued
Predicate
Logic and
Quantifiers
CSE235
25 / 1
Predicate
Logic and
Quantifiers
CSE235
26 / 1
Quantifiers Notes
Truth Values
Predicate
Logic and
Quantifiers
27 / 1
Mixing Quantifiers I Notes
Predicate
Logic and
Quantifiers
CSE235
∀x∃yP (x, y)
28 / 1
Predicate
Logic and
Quantifiers
For example:
CSE235
29 / 1
Predicate
Logic and
Quantifiers
CSE235
Express, in predicate logic, the statement that there are an
infinite number of integers.
31 / 1
Predicate
Logic and
Quantifiers
CSE235
Express, in predicate logic, the statement that there are an
infinite number of integers.
Let P (x, y) be the statement that x < y. Let the universe of
discourse be the integers, Z.
32 / 1
Predicate
Logic and
Quantifiers
CSE235
Express, in predicate logic, the statement that there are an
infinite number of integers.
Let P (x, y) be the statement that x < y. Let the universe of
discourse be the integers, Z.
Then the statement can be expressed by the following.
∀x∃yP (x, y)
33 / 1
Mixing Quantifiers Notes
Example II: More Mathematical Statements
Predicate
Logic and
Quantifiers
CSE235
Express the commutative law of addition for R.
34 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the commutative law of addition for R.
We want to express that for every pair of reals, x, y the
following identity holds:
x+y =y+x
35 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the commutative law of addition for R.
We want to express that for every pair of reals, x, y the
following identity holds:
x+y =y+x
∀x∀y(x + y = y + x)
36 / 1
Mixing Quantifiers Notes
Example II: More Mathematical Statements Continued
Predicate
Logic and
Quantifiers
CSE235
Express the multiplicative inverse law for (nonzero) rationals
Q \ {0}.
37 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the multiplicative inverse law for (nonzero) rationals
Q \ {0}.
We want to express that for every real number x, there exists a
real number y such that xy = 1.
38 / 1
Predicate
Logic and
Quantifiers
CSE235
Express the multiplicative inverse law for (nonzero) rationals
Q \ {0}.
We want to express that for every real number x, there exists a
real number y such that xy = 1.
Then we have the following:
∀x∃y(xy = 1)
39 / 1
Mixing Quantifiers Notes
Example II: False Mathematical Statements
Predicate
Logic and
Quantifiers
CSE235
40 / 1
Predicate
Logic and
Quantifiers
CSE235
41 / 1
Predicate
Logic and
Quantifiers
CSE235
∀x∀y(x − y = y − x)
42 / 1
Mixing Quantifiers Notes
Example II: False Mathematical Statements Continued
Predicate
Logic and
Quantifiers
CSE235
43 / 1
Predicate
Logic and
Quantifiers
CSE235
44 / 1
Predicate
Logic and
Quantifiers
CSE235
45 / 1
Mixing Quantifiers Notes
Exercise
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
46 / 1
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
47 / 1
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
48 / 1
Mixing Quantifiers Notes
Exercise
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
49 / 1
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
50 / 1
Predicate
Logic and
Express the statement “there is a number x such that
Quantifiers
when it is added to any number, the result is that
CSE235
number, and if it is multiplied by any number, the
result is x” as a logical expression.
Solution:
Predicate
Logic and
Quantifiers
CSE235
When a quantifier is used on a variable x, we say that x is
bound. If no quantifier is used on a variable in a predicate
statement, it is called free.
Example
In the expression ∃x∀yP (x, y) both x and y are bound.
In the expression ∀xP (x, y), x is bound, but y is free.
52 / 1
Predicate
Logic and
Quantifiers
CSE235
Example
In the expression ∃x, y∀zP (x, y, z, c) the scope of the
existential quantifier is {x, y}, the scope of the universal
quantifier is just z and c has no scope since it is free.
53 / 1
Negation Notes
Predicate
Logic and
Quantifiers
Just as we can use negation with propositions, we can use
CSE235
them with quantified expressions.
Lemma
Let P (x) be a predicate. Then the following hold.
54 / 1
Negation Notes
Truth Values
Predicate
Logic and
Quantifiers
CSE235
55 / 1
Prolog Notes
Predicate
Logic and
Prolog (Programming in Logic) is a programming language
Quantifiers based on (a restricted form of) Predicate Calculus. It was
CSE235 developped by the logicians of the artificial intelligence
community for symbolic reasoning.
Predicate
Logic and Logic is more precise than English.
Quantifiers
Use ∀ with ⇒
Example: ∀xLion(x) ⇒ F ierce(x)
∀xLion(x) ∧ F ierce(x) means “everyone is a lion and
everyone is fierce”
Use ∃ with ∧
Example: ∃xLion(x) ∧ Drinks(x, cof f ee): holds when
you have at least one lion that drinks coffee
∃xLion(x) ⇒ Drinks(x, cof f ee) holds when you have
people even though no lion drinks coffee.
57 / 1
Conclusion Notes
Predicate
Logic and
Quantifiers Examples? Exercises?
CSE235
58 / 1
Conclusion Notes
Predicate
Logic and
Quantifiers Examples? Exercises?
CSE235
59 / 1
Conclusion Notes
Predicate
Logic and
Quantifiers Examples? Exercises?
CSE235
60 / 1
Extra Question Notes
Predicate
Logic and
Quantifiers
Some students wondered if
CSE235
61 / 1