Lecture Notes 02, Predicates and Quantifiers
Lecture Notes 02, Predicates and Quantifiers
Lecture Notes 02, Predicates and Quantifiers
Imran Shafi
Email: Imran.shafi@umt.edu.pk
Propositional Function - Predicate
A predicate in Discrete Structures is a function with one or more
parameters:
1. Its truth value can be True / False
2. Its value depends upon its variables’ values
3. Variables can have Boolean values
Example:
P(x) = x2 > 10
P (x) x Truth Value
x2 > 10 1 False
x2 > 10 2 False
x2 > 10 3 False
x2 > 10 4 True
Propositional Function - Predicate
Let P(x, y, z) denotes the statement “x = y + z”.
1. What is the truth value of P(3, 2, 1)? True
2. What is the truth value of P(4, -4, 4)? False
3. How many combinations for x, y and z make the statement True?
Infinite many
Quantifiers….
A predicate is transformed into a proposition when we assign a fixed
set of values to its variables. The predicate then can have a truth
value as either True or False.
There is another way of quantifying a predicate i.e., using the
quantifiers. The use of quantifiers can tell us that:
1. The predicate is True for all sets of values for some universe of discourse
(The Universal Quantifier)
2. The predicate is True for some sets of values for some universe of
discourse (The Existential Quantifier)
Universal Quantifiers … ∀
A universal quantification for a predicate P(x) is the proposition
“P(x) is True for all values of x in the universe of discourse”
We denote it as: ∀xP(x)
If the universe of discourse is finite i.e., n ∈ {n1, n2, n3, …., nk} then the universal
quantification is nothing but the conjunction of P(x) for all values of x.
∀xP(x)
The above proposition with have its Truth value equal to True only if
P(x) is True for all values of x.
Example2… continues
Let x = a student
be “x must take Discrete Mathematics course”,
And let be “x is a Computer Science student”.
The Universe of discourse is all UMT students ().
Express the statement: “Every computer science student in UMT must take
discrete mathematics course”
∀x(Q(x) P(x))
The above proposition with have its Truth value equal to True only if it
is True for all values of x.
In what scenario, the above proposition will have False as its truth
value?
Example3
Let x = a student in UMT
Let P(x) be “x must take Discrete Mathematics course”,
And let Q(x) = “x is a Computer Science student”.
The Universe of discourse is all UMT students.
Express the statement: “Every student must take a discrete
mathematics course or be a computer science student”
∀x(Q(x) ∨ P(x))
Existential Quantifiers … ∃
A existential quantification for a predicate P(x) is the proposition
“P(x) is True for some value of x in the universe of discourse”
We denote it as: ∃xP(x)
If the universe of discourse is finite i.e., n ∈ {n1, n2, n3, …., nk} then the existential
quantification is nothing but the disjunction of P(x) for all values of x.
∃xP(x)
The above proposition with have its Truth value equal to True only if
you are able to find at least one honest politician in our country.
Example2… continues
Let x = a politician
P(x) = “x is honest”,
The Universe of discourse is all politicians in our country.
Express the statement mathematically: “Some politicians in our
country are honest.”
∃xP(x)
The above proposition with have its Truth value equal to True only if
you are able to find at least one honest politician in our country.
In what scenario, the above proposition will be False?
Exercise
x = a student
P(x) = x is honest
Q(x) = x is an opportunists
R(x) = x likes to cheat
The universe of discourse is all students in my class.
Negation
All students are not hard-working
Writing in mathematical notation:
: a student
is hard-working
Negation
There is a Lahori who does not like to eat chicken karahi.
∀ 𝑥( x 2> 0)
𝑁𝑒𝑔𝑎𝑡𝑖𝑜𝑛 : ∃ 𝑥 ( 𝑥 ≤ 0 ) 2
Example …4
What is the negation of the following statement?
∃ 𝑥 ( 𝑥 = 5)
2
𝑁𝑒𝑔𝑎𝑡𝑖𝑜𝑛 : ∀ 𝑥 ( 𝑥 ≠ 5 ) 2
Exercises….
Write the following statements into logical expressions:
Everyone of our class has visited Germany.
No one in Lahore owns plane and a car.
Everyone in our class is not happy about his grades.
No one in your school owns both a bicycle and a motorcycle.
There is a student in our class who is not thankful to his parents.
Someone in our class was born in Gujranwala.
Mixing Quantifiers – Nested Quantifiers
Both universal and existential quantifiers can be combined together to quantify
the predicates. For example:
Be careful while evaluating them, these quantifiers are applied from left to right
and their order is important.
Still confusing?
Mixing Quantifiers …
For example:
means there is one (some) x for which P(x, y) is True for every y.
and
means for every y, there will be some y for which P(x, y) is True.
: National
There is a country, everybody belongs to.
Nested Quantifiers – Truth Values
Negation
Statement True, when False, when
P(x, y) is True for every There is one pair (x, y)
pair (x, y) for which P(x, y) is False
For every x there is some There is one x for which
y for which P(x, y) is True P(x, y) is False for all y.
There is some x for which For every x, P(x, y) is
P(x, y) is True for every y False for some y
There is some x for which P(x, y) is False for every
P(x, y) is True for some y pair (x, y)
Nested Quantifiers – Loops … ∀x∀yP(x, y)
In working with quantifications of more than one variable, it is sometimes helpful
to think in terms of nested loops. For example, to see whether ∀x∀yP(x, y) is True,
we loop through the values for x, and for each x we loop through the values for y.
Say X and Y are the sets (arrays) having finite elements:
for (j = 0; j < X.length(); j++) {
for (k = 0; k < Y.length(); k++) {
if (P(x, y) == False ) {
return False
}
}
}
return True;
Nested Quantifiers – Loops … ∃x∃yP(x, y)
In working with quantifications of more than one variable, it is sometimes helpful to
think in terms of nested loops. For example, to see whether ∃x∃yP(x, y) is True, we
can loop through the values for x, and for each x we loop through the values for y.
x, y Є Z+, ∀x∀y (x + y ≥ 0)
Translating Mathematical Statements into Logical Expressions
Translate into logical expression:
“The subtraction of two positive integers does not always results positive”
x, y Є R, ∀xy (x + y = 0)
Translating Mathematical Statements into Logical Expressions
Translate into logical expression:
“Every real number except 0 has a multiplicative inverse inverse”
¬ ∀ 𝑥 ( 𝑃 ( 𝑥 )→ 𝑄 (𝑥 ))
Proved
Predicates & Quantifiers … Example
Express the statements using predicates and quantifiers “Some student in
this class has visited Murree” and “Every student in this class has visited
Karachi and Faisalabad”.
Predicates & Quantifiers … Example
Express the statements “Some student in this class has visited Murree” and
“Every student in this class has visited Karachi and Faisalabad”.
1st statement
mail message
is compressed OR
Predicates & Quantifiers … Example
Express the statements using predicates and quantifiers “Every mail message
larger than one megabyte will be compressed” and “If a user is active, at least
one network link will be available”.
1st statement
mail message
is compressed OR
Predicates & Quantifiers … Example
Express the statements using predicates and quantifiers “Every mail message
larger than one megabyte will be compressed” and “If a user is active, at least
one network link will be available”.
2nd statement
user, network link
is an active user
is available to user