Predicates Reading: EC 1.4 Peter J. Haas INFO 150 Fall Semester - - PowerPoint PPT Presentation

predicates
SMART_READER_LITE
LIVE PREVIEW

Predicates Reading: EC 1.4 Peter J. Haas INFO 150 Fall Semester - - PowerPoint PPT Presentation

Predicates Reading: EC 1.4 Peter J. Haas INFO 150 Fall Semester 2019 Lecture 3 1/ 15 Predicates Simple Predicates and Their Negations Predicates and Sets Quantified Predicates Negating Quantified Predicates Multiple Quantifiers and Their


slide-1
SLIDE 1

Predicates

Reading: EC 1.4 Peter J. Haas INFO 150 Fall Semester 2019

Lecture 3 1/ 15

slide-2
SLIDE 2

Predicates Simple Predicates and Their Negations Predicates and Sets Quantified Predicates Negating Quantified Predicates Multiple Quantifiers and Their Negation

Lecture 3 2/ 15

slide-3
SLIDE 3

Simple Predicates

Definition

A predicate P(x) is a statement having a variable x such that whenever x is replaced by a value, the resulting proposition is unambiguously true or false. For multiple variables, we write P(x1, x2, . . .).

Lecture 3 3/ 15

slide-4
SLIDE 4

Simple Predicates

Definition

A predicate P(x) is a statement having a variable x such that whenever x is replaced by a value, the resulting proposition is unambiguously true or false. For multiple variables, we write P(x1, x2, . . .). Example 1: P(n) = “n is even”

I n = 2: P(2) = “2 is even” [P(2) = T] I n = 17: P(17) = “17 is even” [P(17) = F]

Lecture 3 3/ 15

slide-5
SLIDE 5

Simple Predicates

Definition

A predicate P(x) is a statement having a variable x such that whenever x is replaced by a value, the resulting proposition is unambiguously true or false. For multiple variables, we write P(x1, x2, . . .). Example 1: P(n) = “n is even”

I n = 2: P(2) = “2 is even” [P(2) = T] I n = 17: P(17) = “17 is even” [P(17) = F]

Example 2: Evaluate the following predicate for x = 2, 23, −5, 15

I R(x) = “(x > 5) ∧ (x < 20)”:

Lecture 3 3/ 15

RG )=f

RCB

)

=

f

RC

  • 5)

IF

Ras

)=T

slide-6
SLIDE 6

Negation of Simple Predicates

Techniques carry over from negation of propositions Example: P(x) ¬P(x) x > 5 ¬(x > 5) ≡ x ≤ 5

Equivalent for all values of x

(x > 0) ∧ (x < 10) (x ≤ 0) ∨ (x ≥ 10) ¬(x = 8) Example 2: P(x, y) = (x ≥ 0) ∨ (y ≥ 0)

I Negate P(x, y): I Evaluate P(1, 2) =

P(−1, 3) = P(−7, −2) =

Lecture 3 4/ 15

Demory

an 's

Law A-

8 Double negation

^ (

unless )

C 420 ) A

I

yo

)

Demory

ans ' Law

again

T

T

f

slide-7
SLIDE 7

Predicates and Sets

Informal Definition

A set is a collection of objects, which are called elements or members. Example: D = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

I For each predicate, list elements that make it true, and

similarly for the negation

P(x) True for . . . ¬P(x) True for . . . x ≥ 8 8, 9, 10 x < 8 1, 2, 3, 4, 5, 6, 7 (x > 5) ∧ (x is even) 6, 8, 10 (x ≤ 5) ∨ (x is odd) 1, 2, 3, 4, 5, 7, 9 x2 = x (x + 1) is divisible by 3 x > 0 x > x2

We call D the domain of the predicate

Lecture 3 5/ 15

I x
  • fix

2,3

, 4,447,819,10
  • 2. 5,8

Htt ) notdiv.by

's

43,416,7

,

9,10

all XSO none none

xsX2

all
slide-8
SLIDE 8

Truth and Quantifiers

Example: D = {−1, 0, 1, 2} P(x) True for these members of D True for at least one? True for all? x < 0 x2 < x x2 ≥ x Examples of statements with quantifiers I For every k that is a member of the set A = {1, 2, 3, 4, 5}, it is true that k < 20 I There exists a member m of the set G = {−1, 0, 1} such that m2 = m Quantifier notation I ∈: “in” or “belonging to” (set membership) I ∀: “for all” or “for every” I ∃: “there is (at least one)” or “there exists (at least one)” Rewrite the prior statements using mathematical notation I ∀k ∈ A, k < 20 I ∃m ∈ G, m2 = m

Lecture 3 6/ 15

  • I

Yes

No

None

No NO

All

Yes Yes

ex :
  • I
C- D
slide-9
SLIDE 9

Quantified Predicates

Definitions Quantified predicate: A predicate with one or more quantifiers Counterexample: Example showing that a “for all” statement is false Example 1: Translate from English to math and assess truth, for D = {3, 4, 5, 10, 20, 25} I For every n that is a member of D, n < 20: I For all n in the set D, n < 5 or n is a multiple of 5: I There is (at least one) k in the set D such that k2 is also in D: I There exists m a member of the set D such that m 3:

Lecture 3 7/ 16

tntD

, he

20

(

False

:

25

is a

counterexample

)

if

NED

,

Cnes

)v(

n is a multiple ops )

[

True )

Ike

D

,

WED

[

True

, K
  • 5 ]

I

me

D

, m

33 C True

, K =3 ]
slide-10
SLIDE 10

Quantified Predicates

Definitions Quantified predicate: A predicate with one or more quantifiers Counterexample: Example showing that a “for all” statement is false Example 2: Translate from math to English and assess truth, for D = {2, 1, 0, 1, 2} I 8n 2 D, n > 2: I 9n 2 D, n > 2: I 8n 2 D, (n > 3) ^ (n < 3): I 9m 2 D, m > 10:

Lecture 3 8/ 16

for

all

n

in

the set D

,

h

>
  • 2

[ false

: n
  • 2
is a counterexample]

For

at

least

  • ne
n in the set

D

, n >
  • L

[

True ]

For

all n in

the

set D

, no
  • 3

and

n

23

lie

. ,
  • 32
n c 3)

[ True ]

There

exists

at

least

  • ne
m ED

such that

  • n
>

lo

C false ]

slide-11
SLIDE 11

Specify the Domain!

For each quantified statement, determine the domain D and rewrite formally. If the domain is ambiguous, give examples of how different domains can change the truth

  • f the statement.

I R = the real numbers (R>0 = positive real numbers) I Z = the integers, i.e., {0, ±1, ±2, ±3, . . .}

  • 1. For all x, x2 x

I If D = R: 8x 2 R, x2 x [false since x = 0.5 is a counterexample] I If D = Z: 8x 2 Z, x2 x [true]

  • 2. 8 even integer m, m ends in the digit 0, 2, 4, 6, or 8

I D = set of even integers: 8m 2 D, m ends in the digit 0, 2, 4, 6, or 8

  • 3. There is an integer n whose square root is also an integer

I D = Z: 9k 2 Z,

p k 2 Z

  • 4. Every real number greater than 0 has a square that is greater than 0

I D = R>0: 8n 2 R>0, n2 > 0 Lecture 3 9/ 16

slide-12
SLIDE 12

Negating Quantified Statements: Example

Example: For D = {−2, −1, 0, 1, 2}, explain why each predicate is

  • false. Write the negation in English and formally.
  • 1. ∀d ∈ D, d < −2:
  • 2. ∃m ∈ D, m > 10:

Lecture 3 10/ 16

There

exists

do D

such that d

3

  • L

I d.6 D

,

d

's

  • 2

Every

element of

D

is

g

to

Ume D

,

m

s

10

slide-13
SLIDE 13

Negating Quantified Statements in General

Proposition

  • 1. The negation of ∀x ∈ D, P(x) is ∃x ∈ D, ¬P(x)
  • 2. The negation of ∃x ∈ D, Q(x) is ∀x ∈ D, ¬Q(x)

Lecture 3 11/ 16

slide-14
SLIDE 14

Negating Quantified Statements in General

Proposition

  • 1. The negation of ∀x ∈ D, P(x) is ∃x ∈ D, ¬P(x)
  • 2. The negation of ∃x ∈ D, Q(x) is ∀x ∈ D, ¬Q(x)

Example: For D = {1, 0, 1, 2}, write the negation & determine which version is true

  • 1. 8x 2 D, (x  0) _ (x 2):
  • 2. 9x 2 D, (x < 0) _ (x2 > 0):
  • 3. 8x 2 D, x2 < x:
  • 4. There exists x 2 D such that x2 < x:

Lecture 3 11/ 16

Ix ED

,

txt

HA

YAH

FIXED

,

Cx >

  • )
n Cx

thx ED

,

ex

> o)

Nx

  • ) ④

Xo D ,

7h14

x ) =

EX ED

,

X

's

x TO

the

D

,

xn

>

x

TO

slide-15
SLIDE 15

Multiple Quantifiers

Reminder: Predicates can have multiple arguments Example: P(x, y) = (x ∈ Z) ∧ (y ∈ Z) ∧ (x · y = 36)

I Evaluate: P(9, 4) =

P(−6, −6) = P(4, −1) =

I If we replace Z by R, then P(x, y) = T for infinitely many

(x, y) pairs (e.g., x = 72, y = 0.5)

Lecture 3 12/ 16

T

T

f

slide-16
SLIDE 16

Multiple Quantifiers

Reminder: Predicates can have multiple arguments Example: P(x, y) = (x ∈ Z) ∧ (y ∈ Z) ∧ (x · y = 36)

I Evaluate: P(9, 4) =

P(−6, −6) = P(4, −1) =

I If we replace Z by R, then P(x, y) = T for infinitely many

(x, y) pairs (e.g., x = 72, y = 0.5) Multiple quantifiers of the same type (the easier case)

I There exist integers x and y such that x · y = 36

I ∃x ∈ Z, ∃y ∈ Z, x · y = 36 or ∃x, y ∈ Z, x · y = 36

I For all integers x and y, it is true that x · y = 36

I ∀x ∈ Z, ∀y ∈ Z, x · y = 36 or ∀x, y ∈ Z, x · y = 36 Lecture 3 12/ 16

T T

F

slide-17
SLIDE 17

Mixed Quantifiers

For two variables: Two basic kinds (the truth game)

I ∀x, ∃y, P(x, y): Opponent gives you x, you need to find y I ∃y, ∀x, P(x, y): You need to find y that can handle any

  • pponent’s x

Lecture 3 13/ 16

slide-18
SLIDE 18

Mixed Quantifiers

For two variables: Two basic kinds (the truth game)

I ∀x, ∃y, P(x, y): Opponent gives you x, you need to find y I ∃y, ∀x, P(x, y): You need to find y that can handle any

  • pponent’s x

Versus ambiguous English sentences

I “For every problem there is a solution” vs “There is a solution

for every problem”

I Let P(x, y) = “x is a solution for problem y” I ∀y, ∃x, P(x, y) vs ∃x, ∀y, P(x, y)

Lecture 3 13/ 16

same

meaning

For

every

problem

,

there

exists

a solution

There exist

a

solution

that

solves

all

problems

slide-19
SLIDE 19

Playing the Truth Game

Which of the following are true?

  • 1. ∀x ∈ Z, ∃y ∈ Z, x + 2y = 3
  • 2. ∀x ∈ Z, ∃y ∈ Z, x + y = 15
  • 3. ∃y ∈ Z, ∀x ∈ Z, x + y = 15

Lecture 3 14/ 16

take

4=2

:

2 thy =3

implies

2yd

implies y ¢

I

choose y

  • 15
  • x

You

can't possibly

win

because You go

first

slide-20
SLIDE 20

Negating Multiple Quantifiers

Apply our proposition from left to right: I The negation of 8x 2 D, P(x) is 9x 2 D, ¬P(x) I The negation of 9x 2 D, Q(x) is 8x 2 D, ¬Q(x) Example 1 ¬(8x 2 Z, 9y 2 Z, x + 2y = 3) initial negation 9x 2 Z, ¬(9y 2 Z, x + 2y = 3) by proposition 9x 2 Z, 8y 2 Z, ¬(x + 2y = 3) by proposition 9x 2 Z, 8y 2 Z, (x + 2y 6= 3) equivalent form of “not equal”

Lecture 3 15/ 16

slide-21
SLIDE 21

Negating Multiple Quantifiers

Apply our proposition from left to right: I The negation of 8x 2 D, P(x) is 9x 2 D, ¬P(x) I The negation of 9x 2 D, Q(x) is 8x 2 D, ¬Q(x) Example 1 ¬(8x 2 Z, 9y 2 Z, x + 2y = 3) initial negation 9x 2 Z, ¬(9y 2 Z, x + 2y = 3) by proposition 9x 2 Z, 8y 2 Z, ¬(x + 2y = 3) by proposition 9x 2 Z, 8y 2 Z, (x + 2y 6= 3) equivalent form of “not equal” Example 2 ¬

  • 9x 2 Z, 9y 2 Z, (x + y = 13) ^ (x · y = 36)
  • initial negation

8x 2 Z, ¬

  • 9y 2 Z, (x + y = 13) ^ (x · y = 36)
  • by proposition

8x 2 Z, 8y 2 Z, ¬

  • (x + y = 13) ^ (x · y = 36)
  • by proposition

8x 2 Z, 8y 2 Z, ¬(x + y = 13) _ ¬(x · y = 36) DeMorgan’s laws 8x 2 Z, 8y 2 Z, (x + y 6= 13) _ (x · y 6= 36) equivalent form of “not equal”

Lecture 3 15/ 16

slide-22
SLIDE 22

Negating Multiple Quantifiers: Examples

Negate each quantified predicate. Which is true, the predicate or its negation?

I ∀x ∈ R>0, ∃y ∈ R, (y > x) ∧ (x + y = 2x): I ∃x ∈ Z, ∀y ∈ Z, x · y ≤ 0: I ∀x, y, z ∈ Z, x2 + y2 + z2 ≥ 0

Lecture 3 16/ 16

  • +

it

true

y

  • x

but then ( y

> A)

is false

Jxek.o.V-c.IR

,

flex

)Vlxtytrx)§onisPal€

mythic

in text

Take

1=0

U XEII

,

yet

,

x

. if

> o

TO

I xjyp.CI

,

47942220