Download presentation
Presentation is loading. Please wait.
Published byAlvin Cannon Modified over 9 years ago
2
Lecture 3 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers
3
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.
4
Quantifiers
5
Universal Quantification
6
Existential Quantification
7
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.
8
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
9
Binding Variables
10
DeMorgan's Laws for Quantifiers
11
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.
12
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.
13
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,
15
Understanding compound quantifiers 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 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."
16
Order of Quantifiers
17
Nested Quantifiers: An Example
18
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.
19
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
© 2024 SlidePlayer.com. Inc.
All rights reserved.