Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas
Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas
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
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
Example 2:
• “There is a computer on the university network that is
under attack by an intruder.”
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
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)?
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
Predicates
• Suppose Q(x,y) = “x > y”
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”
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
Universal Quantifiers
Universal Quantification
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
Existential Quantification
Existential Quantification
Existential Quantification
Existential Quantification
Summary
• ∀𝑦 ≠ 0 𝑦 3 ≠ 0 ≡ ∀𝑦 𝑦 ≠ 0 → 𝑦 3 ≠ 0
2/22/2021 CSC102-Discrete Structures 28
• ∃𝑧 > 0 𝑧 2 = 2 ≡ ∃𝑧 𝑧 > 0 ∧ 𝑧 2 = 2
Precedence of Quantifiers
Binding Variables
• When a quantifier is used on a variable x, we say that this
occurrence of the variable is bound.
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
• 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.”
∀xC(x)
2/22/2021 CSC102-Discrete Structures 36
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
∃𝒙 𝑹 𝒙 ¬𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 45
∀𝒙 𝑹 𝒙 𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 46
∀𝒙¬ 𝑹 𝒙 𝑪 𝒙 /¬∃𝒙 𝑹 𝒙 𝑪 𝒙
2/22/2021 CSC102-Discrete Structures 47
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.
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