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

Preview:

Citation preview

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– P(2) = – P(50) =

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

4

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

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

7

Negation

Precedence

Operator Precedence

¬ 1

2

3

→ 4

5

8

Quantifiers beat them all. Lesson: Use parentheses

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

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

11

Uniqueness quantifier

12

Logical equivalence with quantifiers