Discrete Structures For Computer Science (DSCS) : BITS Pilani
Discrete Structures For Computer Science (DSCS) : BITS Pilani
Contact Sesion 2
Agenda
Predicate
Quantifiers
Limitations of proposition logic
Proposition logic cannot adequately express the meaning of
statements
Suppose we know
“Every computer connected to the university network is
functioning properly”
No rules of propositional logic allow us to conclude
“MATH3 is functioning properly”
where MATH3 is one of the computers connected to the
university network
4
Example
Cannot use the rules of propositional logic to conclude from
“CS2 is under attack by an intruder”
where CS2 is a computer on the university network
5
1.4 Predicate and quantifiers
Can be used to express the meaning of a wide range of
statements
Allow us to reason and explore relationship between objects
Predicates: statements involving variables, e.g., “x > 3”,
“x=y+3”,
“x+y=z”,
“computer x is under attack by an intruder”,
“computer x is functioning property”
6
Example: x > 3
The variable x is the subject of the statement
Predicate “is greater than 3” refers to a property that
the subject of the statement can have
Can denote the statement by p(x) where p denotes the
predicate “is greater than 3” and x is the variable
p(x): also called the value of the propositional
function p at x
Once a value is assigned to the variable x, p(x)
becomes a proposition and has a truth value
7
Example
Let p(x) denote the statement “x > 3”
– p(4): setting x=4, thus p(4) is true
– p(2): setting x=2, thus p(2) is false
Let a(x) denote the statement “computer x is under
attack by an intruder”. Suppose that only CS2 and
MATH1 are currently under attack
– a(CS1)? : false
– a(CS2)? : true
– a(MATH1)?: true
8
Let Q(x,y) denote” x=y+3. What are the truth values of the
propositions Q(1,2) & Q(3,0)
Q(1,2) : x=1, y=2 which is False.
Q(3,0) : x=3, y=0, which is true.
9
N-ary Predicate
A statement involving n variables, x1, x2, …, xn, can be denoted
by p(x1, x2, …, xn)
p(x1, x2, …, xn) is the value of the propositional function p at
the n-tuple (x1, x2, …, xn)
p is also called n-ary predicate
10
Quantifiers
Express the extent to which a predicate is true
In English, all, some, many, none, few
Focus on two types:
– Universal: a predicate is true for every element under
consideration
– Existential: a predicate is true for there is one or more
elements under consideration
Predicate calculus: the area of logic that deals with predicates
and quantifiers
11
Universal quantifier
“p(x) for all values of x in the domain”
x p(x)
Read it as “for all x p(x)” or “for every x p(x)”
When all the elements can be listed, e.g., x1, x2, …, xn, it follows
that the universal quantification x p (x) is the same as the
conjunction p(x1) ˄p(x2) ˄…˄ p(xn)
Example
What is the truth value of x p (x) where p(x) is the statement
“x2 < 10” and the domain consists of positive integers not
exceeding 4?
Read as
“There is an x such that p(x)”,
“There is at least one x such that p(x)”, or
“For some x, p(x)”
19
Example
Let p(x) be the statement “x>3”.
Is x p (x) true for the domain of all real numbers? T
When all elements of the domain can be listed, , e.g., x1, x2, …,
xn,
it follows that the existential quantification is the same as
disjunction p(x1) ˅p(x2) ˅ … ˅ p(xn)
20
Example
What is the truth value of x p (x)
where p(x) is the statement “x2 > 10” and the domain consists of
positive integers not exceeding 4?
21
Quantifiers: Truth values
In general, when are quantified statements true or false?
23
Translating from English 2
24
Translating from English 3
• Consider:
– “Some students have visited Mexico”
– “Every student in this class has visited Canada or
Mexico”
• Let:
– S(x) be “x is a student in this class”
– M(x) be “x has visited Mexico”
– C(x) be “x has visited Canada”
25
Translating from English 4
26
Translating from English 5
27
Translating from English 6
28
Translating from English 7
• Translate the statements:
– “All hummingbirds are richly colored”
– “No large birds live on honey”
– “Birds that do not live on honey are dull in color”
– “Hummingbirds are small”
• Assign our propositional functions
– Let P(x) be “x is a hummingbird”
– Let Q(x) be “x is large”
– Let R(x) be “x lives on honey”
– Let S(x) be “x is richly colored”
• Let our universe of discourse be all birds
29
Translating from English 8
• Our propositional functions
– Let P(x) be “x is a hummingbird”
– Let Q(x) be “x is large”
– Let R(x) be “x lives on honey”
– Let S(x) be “x is richly colored”
• Translate the statements:
– “All hummingbirds are richly colored”
• x (P(x)→S(x))
– “No large birds live on honey”
• ¬x (Q(x) R(x))
• Alternatively: x (¬Q(x) ¬R(x))
– “Birds that do not live on honey are dull in color”
• x (¬R(x) → ¬S(x))
– “Hummingbirds are small”
• x (P(x) → ¬Q(x))
30
Predicates - more examples
L(x) = “x is a lion.”
Universe of discourse
F(x) = “x is fierce.” is all creatures.
C(x) = “x drinks coffee.”
x (L(x) F(x))
All lions are fierce.
Some lions don’t drink coffee. x (L(x) C(x))
x (F(x) C(x))
Binding Variables
When a quantifier is used on a variable x, we say that
x is bound
If no quantifier is used on a variable in a predicate
statement, the variable is called free
Examples
– In xyP(x,y), both x and y are bound
– In xP(x,y), x is bound but y is free
A statement is called a well-formed formula, when all
variables are properly quantified
Binding Variables: Scope
The set of all variables bound by a common quantifier is called
the scope of the quantifier
For example, in the expression x,yzP(x,y,z,c)
– What is the scope of existential quantifier?
– What is the scope of universal quantifier?
– What are the bound variables?
– What are the free variables?
– Is the expression a well-formed formula?
Binding variables
34
Binding variables 2
35
Negation
We can use negation with quantified expressions as
we used them with propositions
Lemma: Let P(x) be a predicate. Then the followings
hold:
(x P(x)) x P(x)
Ø (x P(x)) x P(x)
This is essentially the quantified version of De
Morgan’s Law (when the universe of discourse is
finite, this is exactly De Morgan’s Law)
Negating quantifications
37
Negating quantifications 2
40
THANKS