Upload
blaircomp2003
View
320
Download
0
Embed Size (px)
DESCRIPTION
Predicates and Quantifiers
Citation preview
Predicates and Quantifiers
1
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 property”
• No rules of propositional logic allow us to conclude“MATH3 is functioning property”where MATH3 is one of the computers connected to the
university network
2
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
to conclude the truth
“There is a computer on the university network that is under attack by an intruder”
3
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”
4
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
5
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
6
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
7
Universal quantifier
• “p(x) for all values of x in the domain”
• Read it as “for all x p(x)” or “for every x p(x)”• A statement is false if and only if p(x) is
not always true• An element for which p(x) is false is called a
counterexample of • A single counterexample is all we need to
establish that is not true 8
)(xpx
)(xpx
)(xpx
)(xpx
Example
• Let p(x) be the statement “x+1>x”. What is the truth value of ?– Implicitly assume the domain of a predicate is not
empty– Best to avoid “for any x” as it is ambiguous to
whether it means “every” or “some”
• Let q(x) be the statement “x<2”. What is the truth value of where the domain consists of all real numbers?
9
)(xpx
)(xqx
Example
• Let p(x) be “x2>0”. To show that the statement is false where the domain consists of all
integers– Show a counterexample with x=0
• When all the elements can be listed, e.g., x1, x2, …, xn, it follows that the universal quantification is the same as the conjunction p(x1) ˄p(x2) ˄…˄ p(xn)
10
)(xpx
)(xpx
Example
• What is the truth value of where p(x) is the statement “x2 < 10” and the domain consists of positive integers not exceeding 4?
is the same as p(1)˄p(2)˄p(3)˄p(4)
11
)(xpx
)(xpx
Existential quantification
• “There exists an element x in the domain such that p(x) (is true)”
• Denote that as where is the existential quantifier
• In English, “for some”, “for at least one”, or “there is”
• 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)”
12
)(xpx
Example
• Let p(x) be the statement “x>3”. Is true for the domain of all real numbers?
• Let q(x) be the statement “x=x+1”. Is true for the domain of all real numbers?• 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)
13
)(xpx
)(xpx
Example
• What is the truth value of where p(x) is the statement “x2 > 10” and the domain consists of positive integers not exceeding 4?
is the same as p(1) ˅p(2) ˅p(3) ˅ p(4)
14
)(xpx
)(xpx
Uniqueness quantifier
• There exists a unique x such that p(x) is true • “There is exactly one”, “There is one and only
one”
15
)(! xp
1!
Quantifiers with restricted domains• What do the following statements mean for
the domain of real numbers?
16
)20( as same 2,0
)00( as same0,0
)00( as same0,0
22
33
22
zzzzz
yyyyy
xxxxx
Be careful about → and ˄ in these statements
Precedence of quantifiers
• have higher precedence than all logical operators from propositional calculus
17
and
))()((n rather tha )())(()()( xqxpxxqxpxxqxpx
Binding variables
18
• When a quantifier is used on the variable x, this occurrence of variable is bound
• If a variable is not bound, then it is free• All variables occur in propositional function of
predicate calculus must be bound or set to a particular value to turn it into a proposition
• The part of a logical expression to which a quantifier is applied is the scope of this quantifier
Example
19
)())()((
)())()((
)1(
yyRxqxpx
xxRxqxpx
yxx
What are the scope of these expressions?Are all the variables bound?
The same letter is often used to represent variablesbound by different quantifiers with scopes that do not overlap
20
Negating quantifications
• Consider the statement:– All students in this class have red hair
• What is required to show the statement is false?– There exists a student in this class that does NOT have red
hair
• To negate a universal quantification:– You negate the propositional function– AND you change to an existential quantification– ¬x P(x) = x ¬P(x)
21
Negating quantifications 2
• Consider the statement:– There is a student in this class with red hair
• What is required to show the statement is false?– All students in this class do not have red hair
• Thus, to negate an existential quantification:– Tou negate the propositional function– AND you change to a universal quantification– ¬x P(x) = x ¬P(x)
22
Translating from English
• Consider “For every student in this class, that student has studied calculus”
• Rephrased: “For every student x in this class, x has studied calculus”– Let C(x) be “x has studied calculus”– Let S(x) be “x is a student”
• x C(x)– True if the universe of discourse is all students in
this class
23
Translating from English 2
• What about if the unvierse of discourse is all students (or all people?)– x (S(x)C(x))
• This is wrong! Why?
– x (S(x)→C(x))
• Another option:– Let Q(x,y) be “x has stuided y”– x (S(x)→Q(x, calculus))
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
• Consider: “Some students have visited Mexico”– Rephrasing: “There exists a student who has visited
Mexico”
• x M(x)– True if the universe of discourse is all students
• What about if the universe of discourse is all people?– x (S(x) → M(x))
• This is wrong! Why?
– x (S(x) M(x))
26
Translating from English 5
• Consider: “Every student in this class has visited Canada or Mexico”
• x (M(x)C(x)– When the universe of discourse is all students
• x (S(x)→(M(x)C(x))– When the universe of discourse is all people
• Why isn’t x (S(x)(M(x)C(x))) correct?
27
Translating from English 6
• Note that it would be easier to define V(x, y) as “x has visited y”– x (S(x) V(x,Mexico))– x (S(x)→(V(x,Mexico) V(x,Canada))
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
Multiple quantifiers
• You can have multiple quantifiers on a statement
• xy P(x, y)– “For all x, there exists a y such that P(x,y)”– Example: xy (x+y == 0)
• xy P(x,y)– There exists an x such that for all y P(x,y) is true”– Example: xy (x*y == 0)
31
Order of quantifiers
• xy and xy are not equivalent!
• xy P(x,y)– P(x,y) = (x+y == 0) is false
• xy P(x,y)– P(x,y) = (x+y == 0) is true
32
Negating multiple quantifiers• Recall negation rules for single quantifiers:
– ¬x P(x) = x ¬P(x)– ¬x P(x) = x ¬P(x)– Essentially, you change the quantifier(s), and negate what
it’s quantifying
• Examples:– ¬(xy P(x,y))
= x ¬y P(x,y)= xy ¬P(x,y)
– ¬(xyz P(x,y,z)) = x¬yz P(x,y,z)= xy¬z P(x,y,z)= xyz ¬P(x,y,z)
33
Negating multiple quantifiers 2
• Consider ¬(xy P(x,y)) = xy ¬P(x,y)– The left side is saying “for all x, there exists a y such that P
is true”– To disprove it (negate it), you need to show that “there
exists an x such that for all y, P is false”
• Consider ¬(xy P(x,y)) = xy ¬P(x,y)– The left side is saying “there exists an x such that for all y,
P is true”– To disprove it (negate it), you need to show that “for all x,
there exists a y such that P is false”
34
Translating between English and quantifiers• The product of two negative integers is positive
– xy ((x<0) (y<0) → (xy > 0))– Why conditional instead of and?
• The average of two positive integers is positive– xy ((x>0) (y>0) → ((x+y)/2 > 0))
• The difference of two negative integers is not necessarily negative– xy ((x<0) (y<0) (x-y≥0))– Why and instead of conditional?
• The absolute value of the sum of two integers does not exceed the sum of the absolute values of these integers– xy (|x+y| ≤ |x| + |y|)
35
Translating between English and quantifiers• xy (x+y = y)
– There exists an additive identity for all real numbers
• xy (((x≥0) (y<0)) → (x-y > 0))– A non-negative number minus a negative number is
greater than zero
• xy (((x≤0) (y≤0)) (x-y > 0))– The difference between two non-positive numbers is not
necessarily non-positive (i.e. can be positive)
• xy (((x≠0) (y≠0)) ↔ (xy ≠ 0))– The product of two non-zero numbers is non-zero if and
only if both factors are non-zero
36
Negation examples• Rewrite these statements so that the negations
only appear within the predicatesa) yx P(x,y)
yx P(x,y)yx P(x,y)
b) xy P(x,y)xy P(x,y)xy P(x,y)
c) y (Q(y) x R(x,y))y (Q(y) x R(x,y))y (Q(y) (x R(x,y)))y (Q(y) x R(x,y))
37
Negation examples• Express the negations of each of these statements so that
all negation symbols immediately precede predicates.a) xyz T(x,y,z)
(xyz T(x,y,z))xyz T(x,y,z)xyz T(x,y,z)xyz T(x,y,z)xyz T(x,y,z)
b) xy P(x,y) xy Q(x,y)(xy P(x,y) xy Q(x,y))xy P(x,y) xy Q(x,y)xy P(x,y) xy Q(x,y)xy P(x,y) xy Q(x,y)