Predicates and Quantifiers-
Predicates
The statements “x > 3”, “x = y +3” and “computer x is
functioning properly” are not propositions
This section discusses how proposition can be produced
from such statements
The statement “x > 3” has two parts –
the variables x, the subject of the statement
Is greater than 3, the predicate, the property that the subject of
the statement can have
We denote P(x) = “x > 3” where P denotes the predicate “is
greater than 3” and x is the variable
Once we assign a value to x, it becomes proposition
3.
Predicates and Quantifiers-
Predicates
Def: A predicate, or propositional function, is a function that
takes some variable(s) as arguments and return True or False
Example: Let P(x) = “x > 3”, what are the truth values of P(2) and
P(4)?
Sol: P(2) = “2 > 3” is false and P(4) = “4 > 3” is true
Example: Let Q(x, y) = “x = y + 3”, what are the truth values of
Q(1, 2) and Q(3, 0)?
Sol: Q(1, 2) = “1 = 2+3” is false Q(3,0)= “3= 0+3” is true
Def: A statement of the form P(x1, x2, …, xn) is the value of the
propositional function P at the n-tuple (x1, x2, …, xn) and P is
called n-ary predicate
4.
Predicates and Quantifiers-
Predicates
Example: Consider the statement
• if x > 0 then x := x + 1.
Here P(x) = “x > 0”. If P(x) is true for the value of x, then
the assignment statement x := x +1 is executed, x is
increased by 1. If P(x) is false for the value of x, then the
assignment statement is not executed, x remains same
The statements that describe valid input are known as
preconditions and the conditions that the output should
satisfy when it has run are known as postconditions
Q: Let R(x, y, z) = “x + y = z”, what are the truth values of
R(1, 2, 3) and R(0, 0, 1)?
5.
Predicates and Quantifiers-
Quantifiers
Another way of changing a predicate into a proposition is
called quantification
In English, the words all, some, many, none, and few are
used in quantifications
Two types of quantifications:
• Universal quantifications – a predicate is true for every element
under consideration
• Existential quantifications – there is one or more elements under
consideration for which predicate is true
The area of logic that deals with predicates and quantifiers
is called predicate calculus
6.
Predicates and Quantifiers– Universal
Quantifiers
Def: The universal quantification of P(x) is the statement
“P(x) for all values of x in the domain”.
The notion ∀𝑥 𝑃(𝑥) denotes the universal quantification of
P(x) . Here ∀ is called universal quantifier. An element for
which P(x) is false is called a counterexample of ∀𝑥 𝑃(𝑥).
Quantifiers:
Statement When True? When False
∀𝑥 𝑃(𝑥) 𝑃(𝑥) is true for every x There is an x for which 𝑃(𝑥) is
false
∃𝑥 𝑃(𝑥) There is an x for which 𝑃(𝑥) is
true
𝑃 𝑥 is false for every x
7.
Predicates and Quantifiers– Universal
Quantifiers
Example: Let 𝑃 𝑥 = "𝑥 + 1 > 𝑥. What is the truth value of
quantification ∀𝑥 𝑃 𝑥 , where the domain consists of all real
numbers?
Sol: Because 𝑃 𝑥 is true for all real numbers 𝑥 , the
quantification ∀𝑥 𝑃 𝑥 is true.
Example: Let Q 𝑥 = "𝑥 < 2“. What is the truth value of the
quantification ∀𝑥 𝑄 𝑥 , where the domain consists of all real
numbers?
Sol: Because 𝑄 𝑥 is not true for every real number 𝑥,
because, for instance, 𝑄 3 is false. That is, 𝑥 = 3 is a
counterexample for the statement ∀𝑥 𝑄 𝑥 .
8.
Predicates and Quantifiers– Universal
Quantifiers
Q: Let P 𝑥 = "𝑥2 > 0“. What is the truth value of the
quantification ∀𝑥𝑃 𝑥 , where the domain consists of all real
numbers?
Q: Let 𝑄 𝑥 = "𝑥2 < 10". What is the truth value of the
quantification ∀𝑥𝑄 𝑥 , where the domain consists of positive
integers less than 4?
Q: Let R 𝑥 = "𝑥2 ≥ 𝑥“. What is the truth value of the
quantification ∀𝑥𝑅 𝑥 , where the domain consists of real
numbers? What is the truth value of the quantification if
the domain consists of all integers?
9.
Predicates and Quantifiers–
Existential Quantifiers
Def: The existential quantification of P 𝑥 is the statement
“There exists an element x in the domain such that P 𝑥 ”.
The notation ∃𝑥 𝑃(𝑥) denotes the existential quantification
of P 𝑥 . Here ∃ is called existential quantifier.
Example: Let 𝑃 𝑥 = "𝑥 > 3“. What is the truth value of the
quantification ∃𝑥 𝑃(𝑥), where the domain consists of all real
numbers?
Sol: Because 𝑃(𝑥) is sometimes true – for instance when 𝑥 =
4 – the existential quantification 𝑃 𝑥 , which is ∃x P(x), is
true.
10.
Predicates and Quantifiers–
Existential Quantifiers
Example: Let 𝑃 𝑥 = "𝑥 + 1“. What is the truth value of the
quantification ∃𝑥 𝑃(𝑥), where the domain consists of all real
numbers?
Sol: Because 𝑃(𝑥) is false for every real numbers 𝑥 , the
quantification ∃𝑥 𝑃(𝑥) is false.
Q: Let 𝑄 𝑥 = "𝑥2
> 10" . What is the truth value of the
quantification ∃𝑥 𝑄(𝑥), where the domain consists of positive
integers not exceeding 4?
Q: Let 𝑅 𝑥 = "𝑥2
> 𝑥" What is the truth value of the
quantification ∃𝑥 𝑅(𝑥) , where the domain consists of real
numbers? What is the truth value of the quantification if the
domain consists of all integers?
11.
Predicates and Quantifiers– Translating
English into Logical Expression
Example: Express the statement “Every student in this
class has studied calculus” using predicates and quantifiers.
Sol: We rewrite as “For every student in this class, the
student has studied calculus”.
“For every student x in this class, x has studied calculus”.
Let 𝑃 𝑥 = "𝑥 ℎ𝑎𝑠 𝑠𝑡𝑢𝑑𝑖𝑒𝑑 𝑐𝑎𝑙𝑐𝑢𝑙𝑢𝑠“, then our statement is
represented by ∀𝑥𝑃(𝑥)
Q: Express the statements “Some Students in this class
visited Dubai” and “Every student in this class has visited
either Makkah or Madina” using predicates and quantifiers
12.
Predicates and Quantifiers–
Quantifiers with Restricted Domain
Example: What do the statements ∀𝑥 < 0(𝑥2
> 0), ∀𝑦 ≠ 0(𝑦3
≠
0), and ∃𝑧 > 0(𝑧2
= 2) mean, where the domain in each case
consists of all real numbers?
Sol: The statement ∀𝑥 < 0 𝑥2
> 0 states that for every number
x with x < 0, 𝑥2
> 0. that is it states “The square of a negative
real number is positive”. The statement is the same as ∀𝑥(𝑥 <
13.
Predicates and Quantifiers–
Quantifiers with Restricted Domain
Note: The restriction of a universal quantification is the same as the
universal quantification of a conditional statement. For instance ∀𝑥 <
0(𝑥2 > 0) is another way of expressing ∀𝑥 𝑥 < 0 → 𝑥2 > 0).
On the other hand, the restriction of an existential quantification is
the same as the existential quantification of a conjunction. For
instance ∃𝑧 > 0 𝑧2 = 2 can be expressed as ∃𝑧 𝑧 > 0 ∧ 𝑧2 = 2 .
Precedence of Quantifiers: The quantifiers ∀ and ∃ have higher
precedence then all logical operators from propositional calculus.
For example, ∀𝑥 𝑃 𝑥 ∨ 𝑄 𝑥 is the disjunction of ∀𝑥 𝑃 𝑥 and 𝑄 𝑥 .
In other words, it means ∀𝑥 𝑃 𝑥 ∨ 𝑄(𝑥) rather than ∀𝑥 (𝑃 𝑥 ∨ 𝑄 𝑥 )
14.
Predicates and Quantifiers– Negating
Quantified Expression
Example: ∀𝑥 𝑃 𝑥 means "𝑃 𝑥 𝑖𝑠 𝑡𝑟𝑢𝑒 𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦 𝑥“
What about ¬∀𝑥 𝑃 𝑥 ?
Sol: ¬∀𝑥 𝑃 𝑥 = 𝑁𝑂𝑇 [P(x) is true for every x.]
• “There is an x for which P(x) is not true.”
• ∃𝑥 ¬𝑃 𝑥 so, ¬∀𝑥 𝑃 𝑥 is logically equivalent to ∃𝑥 ¬𝑃 𝑥 .
Example: ∃𝑥 𝑃 𝑥 𝑚𝑒𝑎𝑛𝑠 "𝑃(𝑥) 𝑖𝑠 𝑡𝑟𝑢𝑒 𝑓𝑜𝑟 𝑠𝑜𝑚𝑒 𝑥. “
What about¬∃𝑥 𝑃 𝑥 = 𝑁𝑂𝑇[P(x) is true for some x]
• P(x) is not true for all x.
• ∀𝑥¬P(x) so, ¬∃𝑥 𝑃 𝑥 𝑖𝑠 𝑙𝑜𝑔𝑖𝑐𝑎𝑙𝑙𝑦 𝑒𝑞𝑢𝑖𝑣𝑎𝑙𝑒𝑛𝑡 𝑡𝑜∀𝑥¬P(x)
15.
Predicates and Quantifiers– Negating
Quantified Expression
De Morgan’s law for quantifiers:
Negation Equivalent
Statement
When is Negation
True?
When False?
¬∃𝑥 𝑃 𝑥 ∀𝑥¬P(x) For every x, P(x) is
false
There is an x for
which P(x) is true
¬∀𝑥 𝑃 𝑥 ∃𝑥 ¬𝑃 𝑥 There is an x for
which P(x) is false
P(x) is true for every
x
16.
Predicates and Quantifiers– Negating
Quantified Expression
Example: What are the negations of the statements
“There is a religious man” and “All Saudi eat Rice”?
Sol: Let P(x) = “x is a religious”, => “There is a religious man”
= ∃𝑥𝑃(𝑥) , where domain consists of all men.
Now, ¬∃𝑥 𝑃 𝑥 = ∀𝑥¬P(x) => “Every man is not religious”
Next, Let Q(x) = “x eats rice” => “All Saudi eat Rice” =
∀𝑥Q(x) , where the domain consists of all Saudi
Now, ¬∀𝑥 𝑄 𝑥 = ∃𝑥¬Q(x) => “Some Saudi doesn’t eat rice”.
Q: What are the negations of the statements
∀𝑥 𝑥2 > 𝑥 𝑎𝑛𝑑 ∃𝑥 (𝑥2 = 2)?
17.
Predicates and Quantifiers– Negating
Quantified Expression
Example: Let L(x) = “x is a lion”, F(x) = “x is fierce” and C(x) = “x
drinks coffee”. Show the quantifiers for the statements (i) All
lions are fierce, (ii) Some lions don’t drink coffee, (iii) Some
fierce creatures don’t drink coffee.
Sol: (i) ∀𝑥 𝐿 𝑥 → 𝐹 𝑥 , ii) ∃𝑥 (L x ٿ ¬𝐶 𝑥 ) , and
iii) ∃𝑥 (𝐹 x ٿ ¬𝐶 𝑥 )
Q: Let B(x) = “x is a hummingbird”, L(x) = “x is a large bird”, H(x)
= “x lives on honey” and R(x) = “x is richly colored”. Show the
quantifiers for the statements i) All hummingbirds are richly
colored, ii) No large birds live on honey, iii) Birds that do not live
on honey are dully colored, and iv) Not all large birds live on
honey.