0% found this document useful (0 votes)
67 views57 pages

Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas

This document provides an overview of predicate logic and quantification. It defines predicates as statements with variables that can be true or false. There are two types of quantifiers - universal and existential. The universal quantifier ∀ means "for all" and is true if the predicate is true for all cases. The existential quantifier ∃ means "there exists" and is true if the predicate is true for at least one case. It provides examples of quantified statements over different domains and discusses restricting quantifiers to part of the domain.

Uploaded by

Subhan Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views57 pages

Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas

This document provides an overview of predicate logic and quantification. It defines predicates as statements with variables that can be true or false. There are two types of quantifiers - universal and existential. The universal quantifier ∀ means "for all" and is true if the predicate is true for all cases. The existential quantifier ∃ means "there exists" and is true if the predicate is true for at least one case. It provides examples of quantified statements over different domains and discusses restricting quantifiers to part of the domain.

Uploaded by

Subhan Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Department Of Computer Science, CUI

Lahore Campus
CSC102 - Discrete Structures
By
Mahwish Waqas
2/22/2021 CSC102 - Discrete Structures 2

Lecture Outline

• Predicate Logic
• Predicate
• Quantifier
• Translation of Quantified Statements
2/22/2021 CSC102-Discrete Structures 3

Predicate Logic
• Proposition, YES or NO?

•3+2=5 Yes

•X+2=5 No

• X + 4 = 5 for some X in {1, 2, 3} Yes

• Computer X is under attack by an intruder No


2/22/2021 CSC102-Discrete Structures 4

Why Predicate Logic?


• Propositional Logic is not expressive enough
• It cannot adequately express the meaning of statements in
mathematics and in natural language

Example 1:
“Every computer connected to the university
network is functioning properly.”
• No rules of propositional logic allow us to
conclude the truth of the statement.
2/22/2021 CSC102-Discrete Structures 5

Why Predicate Logic?

Example 2:
• “There is a computer on the university network that is
under attack by an intruder.”

Predicate Logic is more expressive


and powerful
2/22/2021 CSC102-Discrete Structures 6

Propositional Functions(Example)
• “x is greater than 3” or (x > 3)
• The variable x: subject of the statement
• “is greater than 3”: predicate
• P(x): propositional function P at x

• Let P(x) = x > 3


• P(x) has no truth values (x is not given a value)
• P(10) is true: The proposition 10 > 3 is true.
• P(1) is false: The proposition 1 > 3 is false.
• P(x) will create a proposition when given a value
2/22/2021 CSC102-Discrete Structures 7

Propositional Functions(Example)
• Let A(x) = “Computer x is under attack by an intruder.”
• Suppose computers on campus, only CS2 and MATH1
are currently under attack by intruders.
• What are truth values of A(CS1), A(CS2), and A(MATH1)?

• The statement A(CS1) by setting x = CS1 in the statement


“Computer x is under attack by an intruder.”
• CS1 is not on the list of computers currently under attack,
A(CS1) is false.
• CS2 and MATH1 are on the list of computers under
attack, A(CS2) and A(MATH1) are true.
2/22/2021 CSC102-Discrete Structures 8

Propositional Functions
• Functions with multiple variables:
• P(x,y) = x + y == 0
• P(1,2) is false, P(1,-1) is true
• P(x,y,z) = x + y == z
• P(3,4,5) is false, P(1,2,3) is true
• P(x1,x2,x3 … xn) = …
• Anatomy of a propositional function
• P(x) = x + 5 > x

variable predicate
2/22/2021 CSC102-Discrete Structures 9

Predicates

• A predicate is a declarative statement with at


least one variable (i.e. unknown value).
• A predicate, or propositional function, is a function
that takes some variable(s) as arguments and
returns True or False.
2/22/2021 CSC102-Discrete Structures 10

Predicates
• Suppose Q(x,y) = “x > y”

Proposition, YES or NO?


Q(x,y) No

Q(3,4) Yes

Q(x,9) No
Predicate, YES or NO?
Q(x,y) Yes

Q(3,4) No

Q(x,9) Yes
2/22/2021 CSC102-Discrete Structures 11

Quantification
• Quantification expresses the extent to which a predicate
is true over a range of elements.
• In English, the words all, some, many, none, and few are
used in quantifications.
• The area of logic that deals with predicates and
quantifiers is called the predicate calculus.
2/22/2021 CSC102-Discrete Structures 12

Types of Quantifiers
• A quantifier is “an operator that limits the
variables of a proposition”.

• Two types:
• Universal
• Existential
2/22/2021 CSC102-Discrete Structures 13

Universal Quantifiers
• Represented by an upside-down A: 
•It means “for all”
• Let P(x) = x+1 > x
• We can state the following:
• x P(x)
• English translation: “for all values of x, P(x) is
true”
• English translation: “for all values of x, x+1>x is
true”
Besides “for all”, universal quantification can be expressed
in many other ways: “for every”, “all of”, “for each”, “given
any”, “for arbitrary”, “for each” and “for any”
2/22/2021 CSC102-Discrete Structures 14

Universal Quantifiers
• You need to specify the universe of quantification!
• What values 𝑥 can represent
• Called the “domain of discourse” or “universe of
discourse”
• Or just “domain” or “universe”

• The meaning of the universal quantification of P(x)


changes when we change the domain. The domain must
always be specified when a universal quantifier is used;
without it, the universal quantification of a statement is not
defined.
2/22/2021 CSC102-Discrete Structures 15

Universal Quantifiers
• Let the universe of discourse be the real numbers.
• Let P(x) = x/2 < x
• Not true for the negative numbers!
• Thus, x P(x) is false, When the domain is all the real numbers

• In order to prove that a universal quantification is true, it


must be shown for ALL cases

• In order to prove that a universal quantification is false, it


must be shown to be false for only ONE case
2/22/2021 CSC102-Discrete Structures 16

Universal Quantifiers

• Let P(x) is “𝑥 2 > 0.” To show that the statement ∀xP(x) is


false where the universe of discourse consists of all
integers, we give a counterexample.

• x = 0 is a counterexample because 𝑥 2 = 0 when x = 0, so


that 𝑥 2 is not greater than 0 when x = 0.
2/22/2021 CSC102-Discrete Structures 17

Universal Quantification

• Given some propositional function P(x) And values in the


universe x1 .. xn

• The universal quantification x P(x) implies:

• P(x1)  P(x2)  …  P(xn)


2/22/2021 CSC102-Discrete Structures 18

Question
• What is the truth value of ∀𝑥 𝑃 (𝑥), where 𝑃(𝑥) is the
statement x 2 < 10 and the domain consists of the positive
integers not exceeding 4?

Solution:
• The statement ∀𝑥𝑃(𝑥) is the same as the conjunction
𝑃 1 ∧ 𝑃 2 ∧ 𝑃 3 ∧ 𝑃(4),
• Because 𝑷 𝟒 ≡ 𝟒𝟐 < 𝟏𝟎, is false, it follows that ∀𝒙 𝑷(𝒙)
is false.
2/22/2021 CSC102-Discrete Structures 19

Existential Quantification
• Represented by an backwards E: 
• It means “there exists”, there is”, “for some”, etc.
• Let P(x) = x+1 > x

• We can state the following:


• x P(x)
• English translation: “there exists (a value of) x such
that P(x) is true”
• English translation: “for at least one value of x, x+1>x
is true”
• English translation: “for some x, P(x)”
2/22/2021 CSC102-Discrete Structures 20

Existential Quantification

• Let P(x) = x+1 > x


• There is a numerical value for which x+1>x
• In fact, it’s true for all of the values of x. Thus,  x
P(x) is true

• In order to show an existential quantification is true, you


only have to find ONE value

• In order to show an existential quantification is false, you


have to show it’s false for ALL values
2/22/2021 CSC102-Discrete Structures 21

Existential Quantification

• Example: Let P(x) denote the statement “x > 3.” What is


the truth value of the quantification ∃xP(x), where the
domain consists of all real numbers?

• Solution: Because “x > 3” is sometimes true—for


instance, when x = 4 the existential quantification of P(x),
which is ∃xP(x), is true.
2/22/2021 CSC102-Discrete Structures 22

Existential Quantification

• Example: Let Q(x) denote the statement “x ==x + 1.”What


is the truth value of the quantification ∃xQ(x), where the
domain consists of all real numbers?

• Solution: Because Q(x) is false for every real number x,


the existential quantification of Q(x), which is ∃xQ(x), is
false.
2/22/2021 CSC102-Discrete Structures 23

Existential Quantification

• Given some propositional function P(x) And values in the


universe x1 .. xn

• The existential quantification x P(x) implies:

• P(x1)  P(x2)  …  P(xn)


2/22/2021 CSC102-Discrete Structures 24

Summary

Statement When True? When False?


xP(x) P(x) is true for every x. There is an x for which
P(x) is false.
∃x P(x) There is an x for which P(x) is false for every x.
P(x) is true.
2/22/2021 CSC102-Discrete Structures 25

Quantifiers with Restricted Domain


• An abbreviated notation is often used to restrict the
domain of a quantifier.
• In this notation, a condition a variable must satisfy is
included after the quantifier.

• ∀𝑥 < 0 𝑥 2 > 0 where domain is real numbers


2/22/2021 CSC102-Discrete Structures 26

Quantifiers with Restricted Domain

• ∀𝑥 < 0 𝑥 2 > 0 ≡ ∀𝑥 (𝑥 < 0) → (𝑥 2 > 0)

• The restriction of a universal quantification is the same as


the universal quantification of a conditional statement.
2/22/2021 CSC102-Discrete Structures 27

Quantifiers with Restricted Domain

• ∀𝑦 ≠ 0 𝑦 3 ≠ 0 ≡ ∀𝑦 𝑦 ≠ 0 → 𝑦 3 ≠ 0
2/22/2021 CSC102-Discrete Structures 28

Quantifiers with Restricted Domain

• ∃𝑧 > 0 𝑧 2 = 2 ≡ ∃𝑧 𝑧 > 0 ∧ 𝑧 2 = 2

• The restriction of an existential quantification is the same


as the existential quantification of a conjunction.
2/22/2021 CSC102-Discrete Structures 29

Precedence of Quantifiers

• The quantifiers  and  have higher precedence then all


logical operators from propositional calculus.

• e.g x P(x)  Q(x) is the disjunction of x P(x) and Q(x).


2/22/2021 CSC102-Discrete Structures 30

Binding Variables
• When a quantifier is used on a variable x, we say that this
occurrence of the variable is bound.

• An occurrence of a variable that is not bound by a


quantifier or not set equal to a particular value is said to
be free.

• The part of a logical expression to which a quantifier is


applied is called the scope of the quantifier.

• All the variables that occur in a logical expression must be


bound or set equal to a particular value to turn into a
proposition.
2/22/2021 CSC102-Discrete Structures 31

Binding Variables

• Examples:

• P(x) x is free
• P(5) x is bound to 5
• x P(x) x is bound by quantifier
2/22/2021 CSC102-Discrete Structures 32

Binding Variables
• x (P(x)  Q(x))  (xR(x))
• All variables are bound.
• The scope of the first quantifier, ∃x, is the expression P(x)
∧ Q(x) because ∃x is applied only to P(x) ∧ Q(x), and not
to the rest of the statement.
• Similarly, the scope of the second quantifier, ∀x, is the
expression R(x).
• That is, the existential quantifier binds the variable x in
P(x) ∧ Q(x) and the universal quantifier ∀x binds the
variable x in R(x).
2/22/2021 CSC102-Discrete Structures 33

Binding Variables
• x (x + y =1)
• x is bound by x and y is free; thus not a proposition
• (x P(x))  Q(x)
• The x in Q(x) is not bound; thus not a proposition
• (x P(x))  (x Q(x))
• Both x values are bound; thus it is a proposition
• x (P(x)  Q(x))  (y R(y))
• All variables are bound; thus it is a proposition
• (x P(x)  Q(y))  (y R(y))
• The y in Q(y) is not bound; thus not a proposition
2/22/2021 CSC102-Discrete Structures 34

A note on quantifiers
• Recall that P(x) is a propositional function
• Let P(x) be “x == 0”
• Recall that a proposition is a statement that is either
true or false
• P(x) is not a proposition
• There are two ways to make a propositional function
into a proposition:
• Supply it with a value
• For example, P(5) is false, P(0) is true
• Provide a quantification
• For example, x P(x) is false and x P(x) is true
• Let the universe of discourse be the real numbers
2/22/2021 CSC102-Discrete Structures 35

Translating From English to Logical Expressions

• Express the statement “Every student in this class has


studied calculus” using predicates and quantifiers.

• Solution:
• Assume domain is students in the class
“For every student in this class, that student has studied calculus.”
“For every student x in this class, x has studied calculus.”

C(x) = “x has studied calculus.”

∀xC(x)
2/22/2021 CSC102-Discrete Structures 36

Translating From English to Logical Expressions

• Express the statement “Every student in this class has


studied calculus” using predicates and quantifiers.
• Let C(x) = “x has studied calculus.”
S(x) = “person x is student in this class.”
The domain for x consists of all people.

• “For every person x, if person x is a student in this class


then x has studied calculus.”

• The statement can be expressed as ∀x(S(x) → C(x)).


2/22/2021 CSC102-Discrete Structures 37

Negating Quantified Expressions


• Consider the statement
“Every student in this class has studied calculus.”
• This statement is a universal quantification, namely,
∀xC(x),
• C(x) is the statement “x has studied calculus”
• Domain consists of the students in the class.
• The negation of this statement is
• “It is not the case that every student in this class has studied
calculus.”
• This is equivalent to “There is a student in this class who has not
studied calculus.”
• This is simply the existential quantification of the negation
of the original propositional function, namely, ∃x ¬C(x).
2/22/2021 CSC102-Discrete Structures 38

Negating Quantified Expressions

Statement When True? When False?


xP(x) P(x) is true for every x. There is an x for which
P(x) is false.
∃x P(x) There is an x for which P(x) is false for every x.
P(x) is true.

Negation Equivalent When is When False?


Statement Negation True?
¬∃xP(x) ∀x¬P(x) For every x, P(x) There is an x for
is false. which
P(x) is true.
¬∀xP(x) ∃x¬P(x) There is an x for P(x) is true for
which P(x) is every x.
false.
2/22/2021 CSC102-Discrete Structures 39

Negating Quantified Expressions


• Example:
What is the negation of the statement “There is an honest
politician”?
Solution:
• Let H(x) denote “x is honest.”
• The statement is represented by ∃xH(x), where the
domain consists of all politicians.
• The negation of this statement is ¬∃xH(x), which is
equivalent to ∀x¬H(x).
• This negation can be expressed as “Every politician is
dishonest.” or Not all politicians are honest.”
2/22/2021 CSC102-Discrete Structures 40

Negating Quantified Expressions


Example:
What is the negation of the statement “All Americans eat
cheeseburgers”?
Solution:
• C(x) denote “x eats cheeseburgers.”
• The statementis represented by ∀xC(x), where the
domain consists of all Americans.
• The negation of this statement is ¬∀xC(x), which is
equivalent to ∃x¬C(x).
• This negation can be expressed as “Some American does
not eat cheeseburgers” and “There is an American who
does not eat cheeseburgers.”
2/22/2021 CSC102-Discrete Structures 41

Negating Quantified Expressions


• What are the negations of the statements
∀𝑥 𝑥 2 > 𝑥 𝑎𝑛𝑑 ∃𝑥 𝑥 2 = 𝑥 ?

x ( x 2  x ) x ( x 2 = x )
 x ( x 2  x )  x ( x 2 = x )
 x( x 2  x )  x( x 2 = x )
 x ( x 2  x )  x ( x 2  x )
2/22/2021 CSC102-Discrete Structures 42

De Morgan’s Laws for Quantifiers


• 𝑥 𝑃(𝑥) ≡ 𝑃(𝑥1)  𝑃(𝑥2)  …  𝑃(𝑥𝑛)
• ∃𝑥𝑃 𝑥 ≡ 𝑃(𝑥1 )  𝑃(𝑥2 )… . 𝑃 𝑥𝑛

• ¬∃𝑥𝑃 𝑥 ≡ ¬(𝑃(𝑥1 )  𝑃(𝑥2 )… . 𝑃 𝑥𝑛 )


≡ ¬𝑃(𝑥1 )  ¬𝑃(𝑥2 )  … . ¬(𝑃 𝑥𝑛 )
≡ ∀𝑥¬𝑃(𝑥)

• ¬∀𝑥𝑃 𝑥 ≡ ¬(𝑃(𝑥1 )  𝑃(𝑥2 )  … . 𝑃 𝑥𝑛 )


≡ ¬𝑃(𝑥1 )  ¬𝑃(𝑥2 )  … . ¬(𝑃 𝑥𝑛 )
≡ ∃𝑥¬𝑃(𝑥)
2/22/2021 CSC102-Discrete Structures 43

Translating From English to Logical Expressions

• Let R(x) = “x can speak Russian”


C(x) = “x knows the computer language C++.”

Express each of these sentences in terms of R(x), C(x),


quantifiers, and logical connectives.
The domain for quantifiers consists of all students at your
school.

• There is a student at your school who can speak Russian


and who knows C++.
∃𝒙 𝑹 𝒙  𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 44

Translating From English to Logical Expressions

• Let R(x) = “x can speak Russian”


C(x) = “x knows the computer language C++.”

• There is a student at your school who can speak Russian


but who doesn’t know C++.

∃𝒙 𝑹 𝒙  ¬𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 45

Translating From English to Logical Expressions

• Let R(x) = “x can speak Russian”


C(x) = “x knows the computer language C++.”

• Every student at your school either can speak Russian or


knows C++.

∀𝒙 𝑹 𝒙 𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 46

Translating From English to Logical Expressions

• Let R(x) = “x can speak Russian”


C(x) = “x knows the computer language C++.”

• No student at your school can speak Russian or knows


C++.

∀𝒙¬ 𝑹 𝒙 𝑪 𝒙 /¬∃𝒙 𝑹 𝒙 𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 47

The Four Aristotelian Forms

1. All A's are B's


2. Some A's are B's
3. No A's are B's
4. Some A's are not B's

• These are four of the most common quantificational


sentences used in quantificational reasoning.
2/22/2021 CSC102-Discrete Structures 48

The First Aristotelian Form

• The Form: All A's are B's


• Example: All comedian are funny.
• Rephrase: For every x, if x is a comedian then x is funny
• Translation: ∀x (Comedian(x) → Funny(x))
• This translation has the form: ∀x (A(x) → B(x))
• General Fact
• All A's are B's translates as ∀x (A(x) → B(x))
2/22/2021 CSC102-Discrete Structures 49

The Second Aristotelian Form


• The Form: Some A's are B's
• Example: Some comedian are funny
• Rephrase: Some thing x is both comedian and funny
• Translation: x (Comedian(x)  Funny(x))
• This translation has the form: x (A(x)  B(x))
• General Fact
• Some A's are B's translates as x (A(x)  B(x))
2/22/2021 CSC102-Discrete Structures 50

The Third Aristotelian Form

• The Form: No A's are B's


• Example: No students are failed
• Rephrase: For every x, if x is a student then x is not failed
• Translation: ∀x (Student(x) → Failed(x))

• This translation has the form: ∀x (A(x) → B(x))


• General Fact
• No A's are B's translates as ∀x (A(x) → B(x))
2/22/2021 CSC102-Discrete Structures 51

The Fourth Aristotelian Form

• The Form: Some A's are not B's


• Example: Some excuses are not believable
• Rephrase: For some x, x is an excuse and x is not believable
• Translation: x (Excuse(x)  Believable(x))
• This translation has the form: x (A(x)  B(x))
• General Fact
• Some A's are not B's translates as x (A(x)  B(x))
2/22/2021 CSC102-Discrete Structures 52

Summary
• The Aristotelian Forms and Their Translations
• All A's are B's ∀x (A(x) → B(x))
• Some A's are B's x (A(x)  B(x))
• No A's are B's ∀x (A(x) → B(x))
• Some A's are not B's x (A(x)  B(x))
2/22/2021 CSC102-Discrete Structures 53

Predicates - Examples
L(x) = “x is a lion.”
F(x) = “x is fierce.”
C(x) = “x drinks coffee.”
Assuming that the domain consists of all creatures.

• All lions are fierce.


x (L(x) → F(x))
• Some lions don’t drink coffee.
x (L(x)  C(x))
• Some fierce creatures don’t drink coffee.
x (F(x)  C(x))
2/22/2021 CSC102-Discrete Structures 54

Predicates - Examples
B(x) = “x is a hummingbird.”
L(x) = “x is a large bird.”
H(x) = “x lives on honey.”
R(x) = “x is richly colored.”
Assuming that the domain consists of all birds.
• All hummingbirds are richly colored.
x (B(x) → R(x))
• No large birds live on honey.
x (L(x) → H(x))
• Birds that do not live on honey are dully colored.
x (H(x) → R(x))
• Hummingbirds are small.
x (B(x) → L(x))
2/22/2021 CSC102-Discrete Structures 55

Example
• Express each of these statements using quantifiers. Then
form the negation of the statement, so that no negation is
to the left of a quantifier. Next, express the negation in
simple English as well.
a) Some old dogs can learn new tricks.
b) No rabbit knows calculus.
c) Every bird can fly.
d) There is no dog that can talk.
e) There is no one in this class who knows French and
Russian.
2/22/2021 CSC102-Discrete Structures 56

Chapter Reading
• Chapter 1, Kenneth H. Rosen, Discrete Mathematics and
Its Applications, Section 1.4
2/22/2021 CSC102-Discrete Structures 57

Chapter Exercise (For Practice)

• Question # 1, 2, 5, 6, 7, 8, 10, 11, 12, 14, 17, 18, 35, 36,


59(a, b, c), 60( a, b, c), 61(a, b, c, d)

You might also like