Upload
alvin-cannon
View
268
Download
1
Tags:
Embed Size (px)
Citation preview
Lecture 3
1.3 Predicates and Quantifiers 1.4 Nested Quantifiers
Predicates
The statement "x is greater than 3" has two parts. The first part, "x", is the subject of the statement. The second part, "is greater than 3" is called the predicate.
Quantifiers
Universal Quantification
Existential Quantification
Logical Equivalences Involving Quantifiers
Statements involving predicates and quantifiers are logically equivalent iff they have the same
truth value for all applications and for all domains of discourse.
)()()()( xQxxPxxQxPx
)()( xPxxxP
)()( xPxxxP
)()()()( xQxPxxQxPx
News Flash! Predicates are not propositions!they are propositional functions
subject predicate proposition
x x was a man. Daniel Boone was a man.
x x > 3 2 > 3
x,y Q(x,y) Q(2,3)
x,y,z R(x,y,z)=> x+y=z R(1,2,3) true
R(0,0,1) false
A predicate can be turned into a proposition by instantiation of its variables...
or by quantification...
subject predicate proposition
x x was a man
x x>3
x,y Q(x,y)
x,y,z R(x,y,z)=> x+y=z
)manawasx(x
)x(x 3
)y,x(Qyx
zyxzyx
Binding Variables
DeMorgan's Laws for Quantifiers
)x(P)x(P)x(P)x(xP n 21
Universal Quantifiers and Negation
For all x, P(x) is true.
To show that the universal quantifier is not true we need only to show a counterexample. That is we demonstrate that the negation of the universal quantifier is true.
)x(Px)x(xP
)x(P)x(P)x(P
)x(P)x(P)x(P
)x(Px)x(xP
n
n
21
21
Existential Quantifier and Negation
Existential quantifiers state that in the domain of discourse there exists as least one member for which the predicate is true.
)x(P)x(P)x(P)x(Px n 21
The negation of the existential quantifier says that none of the members of the domain of discourse make the predicate true.
)x(P)x(P)x(P
)x(P)x(P)x(P)x(Px
n
n
21
21
)x(B)x(F)x(Mx
)bat,x(T)x(F)mammal,x(Tx
There is more than one way to x a y.
We can express the statement,
"There is an animal that is a mammal and can fly but is not a bat", as a logical proposition,
where,
M(x) = x is a mammal F(x) = x can fly B(x) = x is a bat
Alternatively we can create predicates with multiple variables, such as
T(x,y) = returns true if x is a y
which allows us to rewrite the logical proposition as,
Understanding compound quantifiers
z)yx()zy(xzyx
xyyxyx
yxyx
0
For all x there exists a y such that x+y=0 - additive inverse
For all x and y, x+y is equal to y+x. - commutative law
For all x,y and z, x plus the quantity y+z is equal to the quantity x+y plus the value z. - associative law
Math Expressions
)y,x(F)y(Cy)x(Cx
Logical Expressions
C(x) - x owns a computerF(x,y) - x and y are friends
"Every student either owns a computer or has a friend that owns a computer."
Order of Quantifiers
Nested Quantifiers: An Example
Negating Compound Quantifiers... Au contraire, mon ami
Express the negation of the statement
so that no negation precedes a quantifier.
1
1
1
1
1
xyyx
xyyx
xyyx
xyyx
xyyx
It is not true that...
There exists some x such that there does not exist a y that makes xy=1
There exists some x such that for all y, x times y does not equal 1.
Compound Quantifiers as Nested Loops
Nested Loons
zyxzyx
isa_z = false;for x in x1..xn loop for y in y1..yn loop for z in z1..zn loop if x+y=z then isa_z = true; end if; end loop; end loop;end loop;
Propositional quantifiers imply an evaluation of the predicate for all possible values in the domain of discourse. Sometimes the domain is infinite and possibly uncountable, but we can still consider the comparison as being implemented as a nested loop.
In the code segment above, is there a more efficient way to represent existential quantifiers?