12
Math 51/COEN 19 Day 3, 1.4 Quantifiers 1

Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Embed Size (px)

Citation preview

Page 1: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Math 51/COEN 19 Day 3, 1.4 Quantifiers

1

Page 2: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x
Page 3: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

3

Page 4: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Predicates

• A lot like functions that return booleans• Let P(x) denote x<12– P(2) = – P(50) =

• Let P(x, y, z) denote x-y<z– P(5, 4, 2) = – P(10, 5, 1) =

4

Page 5: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Quantifiers• Allow us to reason about the way predicates

behave over a domain (don’t forget the domain!)

• “Universal quantifier”– For all, for every, all of, for each, given any, for

arbitrary, for each, for any• “Existential quantifier”– There exists, for some, for at least one, there is

• P(x) denotes x-x=0 and Q(x) denotes x+2=8 where x is an integer

5

Page 6: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Relationship to propositional logic

P(x) denotes x<10, domain positive integers less than 5• Universal quantifier is like a big conjunction

• Existential quantifier is like

6

Page 7: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

7

Negation

Page 8: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

Precedence

Operator Precedence

¬ 1

2

3

→ 4

5

8

Quantifiers beat them all. Lesson: Use parentheses

Page 9: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

9

Binding of variables and scope

• Variables tied to a quantifier are bound, while those not tied to a quantifier are free.

• The part of the logical expression the quantifier applies to is the scope.

• We often reuse variable names, so pay attention to scope

Page 10: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

10

English to logic with quantifiers!

• There’s a girl with a crown and a sword• No one knows if P=NP• For every integer x, if x is an odd square then x

is one more than a multiple of 4• The lights are off when everyone is out of the

room

Page 11: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

11

Uniqueness quantifier

Page 12: Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x

12

Logical equivalence with quantifiers