LEct 6
LEct 6
Section Summary
Predicates
Variables
Quantifiers
Universal Quantifier
Existential Quantifier
Negating Quantifiers
De Morgan’s Laws for Quantifiers
Translating English to Logic
Propositional Logic Not Enough
“He is a college student” is not a statement because
it may be either true or false depending on the value of
the pronoun he.
“x + y is greater than 0” is not a statement
because its truth value depends on x and y
Propositional Logic Not Enough
Propositional logic, cannot adequately express the
meaning of all statements in mathematics, in Computer
science and in natural language. For example, suppose
that we know that
Every computer connected to the university network is
functioning properly.
We cannot translate it in the propositional logic
Propositional Logic Not Enough
Likewise,
If we have:
“All men are mortal.”
“Socrates is a man.”
no rules of propositional logic allow us to conclude the
truth of the statement
“Socrates is mortal”
Introducing Predicate Logic
We will introduce a more powerful type of logic
called predicate logic.
To understand predicate logic, we first need to
introduce the concept of a predicate. Afterward, we
will introduce the notion of quantifiers.
Predicate
A predicate is a sentence that contains a finite
number of variables and becomes a statement
when specific values are substituted for the
variables.
The domain of a predicate variable is the set of all
values that may be substituted in place of the
variable.
Example: x > 3
We can denote the statement “x is greater than 3”
by P(x),
Once a value has been assigned to the variable x, the
statement P(x) becomes a proposition and has a
truth value
Introducing Predicate Logic
Predicate logic uses the following new features:
Variables: x, y, z
Predicates: P(x), M(x)
Quantifiers (to be covered in a few slides):
Propositional functions are a generalization of
propositions.
They contain variables and a predicate, e.g., P(x)
Variables can be replaced by elements from their
domain.
Propositional Functions
Propositional functions become propositions (and have
truth values) when their variables are each replaced by a
value from the domain (or bound by a quantifier, as we
will see later).
For example, let P(x) denote “x > 0” and the domain be
the integers. Then:
P(-3) is false.
P(0) is false.
P(3) is true.
Often the domain is denoted by U. So in this example U
is the integers.
Example
• Let p(x) denote the statement “x > 3”
– p(4): setting x=4, thus p(4) is true
– p(2): setting x=2, thus p(2) is false
•
11
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
Quantifiers
We need quantifiers to express the meaning of English
words including all and some:
“All men are Mortal.”
“Some cats do not have fur.”
The two most important quantifiers are:
Universal Quantifier, “For all,” symbol:
Existential Quantifier, “There exists,” symbol:
Universal Quantifier
x P(x) is read as “For all x, P(x)” or “For every x, P(x)”
Let P(x) be a predicate and D the domain of x. An
universal statement is a statement of the form
“∀x ∈ D, P(x).” It is defined to be true if, and only if,
P(x) is true for every x in D. It is defined to be false
if, and only if, P(x) is false for at least one x inD.
A value for x for which P(x) is false is called a
counterexample to the universal statement.
Universal Quantifier
a. Let D ={1, 2, 3, 4, 5}, and consider the statement
∀x ∈ D, x2≥ x. Show that this statement is true.
b. Consider the statement
∀x ∈ R, x2≥x.
Find a counterexample to show that this statement
is false.
Existential Quantifier
x P(x) is read as “For some x, P(x)”, or as “There is an
x such that P(x),” or “For at least one x, P(x).”
Let P(x) be a predicate and D the domain of
x. An existential statement is a statement
of the form “∃x ∈ D such that P(x).” It is
defined to be true if, and only if, P(x) is true
for at least one x in D. It is false if, and only
if, P(x) is false for all x in D.
Existential Quantifier
x P(x) is read as “For some x, P(x)”, or as “There is an
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
x P(x) is false.
3. If P(x) denotes “x is even” and U is the integers, then x
P(x) is true.
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),
2. x P(x)
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 negative integers and P(x) is the statement
“x < 2”, then x P(x) ? x P(x)?
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 consists of 3, 4, and 5, and P(x) is the statement
“x > 2”, then x P(x)? x P(x)?
2. If U consists of 3, 4, and 5, and P(x) is the statement
“x < 2”, then x P(x)? x P(x) ?
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.
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.
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).
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”
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)).
x (S(x) ∧ J(x)) is not correct. What does it mean?
Translating from English to Logic
Example 2: Translate the following sentence into
predicate logic: “Some student in this class has taken a
course in Java.”
Translating from English to Logic
Example 2: Translate the following sentence into
predicate logic: “Some 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, translate as
x J(x)
Translating from English to Logic
Example 2: Translate the following sentence into
predicate logic: “Some student in this class has taken a
course in Java.”
Solution:
First decide on the domain U.
If U is all people, then
Translating from English to Logic
Example 2: Translate the following sentence into
predicate logic: “Some student in this class has taken a
course in Java.”
Solution:
First decide on the domain U.
But if U is all people
x (S(x) ∧ J(x))
Universal Conditional Statements
∀x, if P(x) then Q(x ).
37
Negating quantifications
• Consider the statement:
– All students in this class have red hair
• What is required to show the statement is false?
– There exists a student in this class that does NOT have
red hair
• To negate a universal quantification:
38
Negating quantifications
• Consider the statement:
– All students in this class have red hair
• What is required to show the statement is false?
– There exists a student in this class that does NOT have
red hair
• To negate a universal quantification:
– You negate the propositional function
– AND you change to an existential quantification
39
De Morgan’s Laws for Quantifiers
The rules for negating quantifiers are:
Translation from English to Logic
Examples:
1. “Some student in this class has visited Mexico.”
Translation from English to Logic
Examples:
1. “Some student in this class has visited Mexico.”
Solution: Let M(x) denote “x has visited Mexico” and
S(x) denote “x is a student in this class,” and U be all
people.
Translation from English to Logic
Examples:
1. “Some student in this class has visited Mexico.”
Solution: Let M(x) denote “x has visited Mexico” and
S(x) denote “x is a student in this class,” and U be all
people.
x (S(x) ∧ M(x))
2. “Every student in this class has visited Canada or
Mexico.”
Solution:
Translation from English to Logic
Examples:
1. “Some student in this class has visited Mexico.”
Solution: Let M(x) denote “x has visited Mexico” and
S(x) denote “x is a student in this class,” and U be all
people.
x (S(x) ∧ M(x))
2. “Every student in this class has visited Canada or
Mexico.”
Solution: Add C(x) denoting “x has visited Canada.”
x (S(x)→ (M(x)∨C(x)))