Lecture Notes 02, Predicates and Quantifiers

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 60

Propositional Logic

Propositional Functions 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) ↔ P(n1) ∧ P(n2) ∧ P(n3) ∧ ….. ∧ P(nk)


Example1 …
Let x = a student
P(x) = “x must take Discrete Mathematics course”,
The Universe of discourse is all UMT students.
Express the statement mathematically: “Every student must take
discrete mathematics course”

∀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) ↔ P(n1) ∨ P(n2) ∨ P(n3) ∨ ….. ∨ P(nk)


The above proposition with have its Truth value equal to True only if
P(x) is True for one or more values of x.
Example1 …
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.
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.

1. All students are honest


2. Some students are opportunist
3. A few students are opportunist but they do not like to cheat
4. A few students are opportunist but they like to cheat too
5. All students are honest but some of them are opportunists too
Exercise
x = a teacher
P(x) = x is honest
Q(x) = x is lazy
R(x) = x evaluates the student tasks on time
The universe of discourse is all teachers in a University.

1. All teachers are honest


2. Some teachers are lazy
3. A few teachers are lazy and they do not evaluate students tasks on
time
4. A few teachers are lazy but they evaluate students tasks on time
5. A teacher is not honest and he is lazy too
Truth Values of Quantifiers
Sets and Notations
Set Symbol
Set of Natural Numbers N
Set of Integers Z
Set of Positive Integers Z+
Set of Negative Integers Z-
Set of Real Numbers R
Set of Rational Numbers Q
Examples – Express in Mathematical Notation

Product of two negative integers is positive.


Examples – Express in Mathematical Notation
Product of two negative integers is positive.
Examples – Express in Mathematical Notation
Product of two negative integers is positive.
Average of two positive integers in positive.
Examples – Express in Mathematical Notation
• Product of two negative integers is positive.
• Average of two positive integers is positive.
Examples – Express in Mathematical Notation
• Product of two negative integers is positive.
• Average of two positive integers in positive.
• The difference of two negative integers is not necessarily negative.
Examples – Express in Mathematical Notation
Product of two negative integers is positive.
Average of two positive integers in positive.
The difference of two negative integers is not necessarily negative

Or we may write


Examples – Express in Mathematical Notation
Product of two negative integers is positive.
Average of two positive integers in positive.
The difference of two negative integers is not necessarily negative.
Absolute value of sum of two integers does not exceed the sum of
the absolute values of these integers.
Quantifiers – Negation
Let P(x) be a predicate then the following hold:
1. ¬∀xP(x) = ∃x¬P(x)
2. ¬∃xP(x) = ∀x¬P(x)

These are essentially the quantified versions of De Morgan’s Law.


(In fact if the universe of discourse is finite, it is exactly De
Morgan’s Law)
Quantifiers – Negation

Use De Morgan’s Law


Quantifiers – Negation

Use De Morgan’s Law


Quantifiers – Negation – Truth Values
Statement True When False When
¬∀xP(x) = ∃x¬P(x) P(x) is not True for all of P(x) is True for all x.
x.
OR
P(x) is False for at least
one value of x
¬∃xP(x) = ∀x¬P(x) P(x) is False for all values P(x) is True for at least one
of x. value of x.
Example …1
What is the negation of:
There is a hard-working student.
Example … Solution
What is the negation of:
There is a hard-working student.

Negation
All students are not hard-working
Writing in mathematical notation:
: a student
is hard-working

There is a hard-working student:


Negation: All students are not hard-working:
Example …2
What is the negation of:
All Lahoris like to eat chicken karahi.
Example … Solution
What is the negation of:
All Lahoris like to eat chicken karahi.

Negation
There is a Lahori who does not like to eat chicken karahi.

Writing in mathematical notation:


: a Lahori
likes to eat chicken karahi

All Lahoris like to eat chicken karahi.:


Negation: There is a Lahori who does not like to eat chicken karahi:
Example …3
What is the negation of the following statement?

∀ 𝑥( 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:

All six forms are


valid.

Be careful while evaluating them, these quantifiers are applied from left to right
and their order is important.

are not same.


Mixing Quantifiers …
are not same.
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.

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.

Say P(x, y) denotes “x is the leader of y”


Now for first statement: means:
There is one x that is the leader of every y.

Say P(x, y) denotes “x is the follower of y”


Now for first statement: means:
For every y, there is some leader x. // for every follower there is some leader
Mixing Quantifiers …
Note that: is same as
AND
∀ is same as
Mixing Quantifiers …
If Likes (x, y) = x likes y,
means “every x likes some y”
OR
Simply put “everyone likes someone”

If Likes (x, y) = x likes y,


means “There is some y that is liked by every x”
OR
Simply put “Someone is liked by everyone”
Mixing Quantifiers
: is a person
: is a country
National: is national of
: National
Everyone belongs to some country

: 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.

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) == True ) {
return True
}
}
}
return False;
Nested Quantifiers – Loops … ∃x∀yP(x, y)
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. Overall result is True if P(x, y) is True
for every iteration of internal loop in one iteration of external loop.

Say X and Y are the sets (arrays) having finite elements:


for (j = 0; j < X.length(); j++) {
bool result = True
for (k = 0; k < Y.length(); k++) {
if (P(x, y) == False ) {
result = False; break;
}
}
if (result == True) return True;
}
Nested Quantifiers – Loops … ∀x∃yP(x, y)
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. Overall result is True if P(x, y) is True
for one iteration of internal loop in every iteration of external loop.

Say X and Y are the sets (arrays) having finite elements:


for (j = 0; j < X.length(); j++) {
bool result = False
for (k = 0; k < Y.length(); k++) {
if (P(x, y) == True ) {
result = True; break;
}
}
if (result == False) return False;
}
Translating Mathematical Statements into Logical Expressions
Translate into logical expression:
“The sum of two positive integers is always positive”
Translating Mathematical Statements into Logical Expressions
Translate into logical expression:
“The sum of two positive integers is always positive”

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 Є Z+, ∀x∀y ((x - y ≥ 0) ∨ (x - y < 0))


Translating Mathematical Statements into Logical Expressions
Translate into logical expression:
“Every real number has an additive inverse”

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”

x, y Є R, ∀x ((x ≠ 0) y(x.y = 1))


Translating Logical Expressions into English Statement
Express the expression ∀x(C(x) ∨ ∃y(C(y) ∧ F(x, y))) into English where:
1. C(x) = x has a computer
2. F(x, y) = x and y are friends
The domain of x and y is “all students in the class”.
Translating Logical Expressions into English Statement
Express ∃x∀y∀z((F(x, y) ∧ F(x, z) ∧ (y ≠ z)) → ¬F(y, z)) into English where:
F(x, y) = x and y are friends
The domain of x and y is “all students in the class”.
Translating Logical Expressions into English Statement
Express the following statements into English where domain for each variable is
the set of Real Numbers:
1. ∀x∃y(x < y)
2. ∀x∀y∃z(x.y = z)
3. ∀x((x ≠ 0)  ∃y(x.y=1))
Logical Equivalence
Show that are logically equivalent.

¬ ∀ 𝑥 ( 𝑃 ( 𝑥 )→ 𝑄 (𝑥 ))

Using De Morgan’s Law

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”.

: Students in the class : Students


has visited Murree is student in this class
has visited Murree
================
has visited ====================
has visited Faisalabad has visited
has visited Faisalabad
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 live, at least
one network link will be available”.
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”.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy