Download presentation
Presentation is loading. Please wait.
1
1.4 Predicates and Quantifiers
Lecture 4 1.4 Predicates and Quantifiers 1.5 Nested Quantifiers
2
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.
3
Quantifiers
4
Universal Quantification
5
Existential Quantification
6
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.
7
News Flash! Predicates are not propositions!
they are propositional functions A predicate can be turned into a proposition by instantiation of its variables... or by quantification... subject predicate proposition x x was a man Daniel Boone was a man. x x > > 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 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
8
Binding Variables
9
DeMorgan's Laws for Quantifiers
10
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.
11
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. The negation of the existential quantifier says that none of the members of the domain of discourse make the predicate true.
12
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,
14
Understanding compound quantifiers
Math Expressions 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 Logical Expressions C(x) - x owns a computer F(x,y) - x and y are friends "Every student either owns a computer or has a friend that owns a computer."
15
Order of Quantifiers
16
Nested Quantifiers: An Example
17
Negating Compound Quantifiers... Au contraire, mon ami
Express the negation of the statement so that no negation precedes a quantifier. 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.
18
Compound Quantifiers as Nested Loops
Nested Loons 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; 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?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.