0% found this document useful (0 votes)
8 views22 pages

Slecture3 Annotated

Uploaded by

mawoloedwin57
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views22 pages

Slecture3 Annotated

Uploaded by

mawoloedwin57
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

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 Negation

Lecture 3 2/ 15
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
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
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 f
)

RCB
RG )=f
=

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

RC 5)
-
IF Ras )=T
Lecture 3 3/ 15
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) Demory 's Law an

¬(x = 8) A- 8 Double negation


( )
^
unless

Example 2: P(x, y ) = (x 0) _ (y 0)
I ) ) Demory
Law again ans
'

Negate P(x, y ): C 420 A


yo
I
I Evaluate P(1, 2) = T P( 1, 3) = T P( 7, 2) = f

Lecture 3 4/ 15
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
I
x2 = x x
-

fix 2,3 ,
4,447,819,10
(x + 1) is divisible by 3 2. 5,8 Htt ) notdiv.by 's
43,416,7 ,
9,10
x >0 all XSO none

x > x2 none xsX2 all

We call D the domain of the predicate


Lecture 3 5/ 15
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 -
I Yes No

x2 < x None No NO

x2 x All Yes Yes

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 2: “in” or “belonging to” (set membership) ex : -
I C-
D
I 8: “for all” or “for every”
I 9: “there is (at least one)” or “there exists (at least one)”

Rewrite the prior statements using mathematical notation


I 8k 2 A, k < 20
I 9m 2 G , m2 = m

Lecture 3 6/ 15
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:


)
False
counterexample
tntD ,
he 20 ( : 25 is a

I For all n in the set D, n < 5 or n is a multiple of 5:

if NED Cnes )v( n is a multiple ops ) [ True )


,

I There is (at least one) k in the set D such that k 2 is also in D:

Ike WED [ True K 5 ]


-

D
-

,
,

I There exists m a member of the set D such that m 3:

I me
D m 33 C True
,
K =3
]
,

Lecture 3 7/ 16
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 >
the
2:
set D [ false : n
-

- -2 is a counterexample ]
for
-2
all n in h >
,

I 9n 2 D, n > 2:
For at least one n in the set D
,
n >
-

L [ True ]
I 8n 2 D, (n >
]
3) ^ (n < 3):
23 lie -32 n c 3) [ True
the set D and
For all
n
3
.

,
n in no -

I 9m 2 D, m > 10:
that C false ]
at least ED such on > lo
exists one m

There

Lecture 3 8/ 16
Specify the Domain!

For each quantified statement, determine the domain D and rewrite formally. If the
domain is ambiguous, give examples of how di↵erent domains can change the truth
of 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, x 2 x
I If D = R: 8x 2 R, x 2 x [false since x = 0.5 is a counterexample]
I If D = Z: 8x 2 Z, x 2 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


p
I D = Z: 9k 2 Z, k2Z
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
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. 8d 2 D, d < 2:
do D such that
d 3
-
L
There exists

I d. 6 D d 's -2
,

element of D
2. 9m 2 D, m > 10:
is g to
Every
Ume D m s
10
,

Lecture 3 10/ 16
Negating Quantified Statements in General

Proposition
1. The negation of 8x 2 D, P(x) is 9x 2 D, ¬P(x)
2. The negation of 9x 2 D, Q(x) is 8x 2 D, ¬Q(x)

Lecture 3 11/ 16
Negating Quantified Statements in General

Proposition
1. The negation of 8x 2 D, P(x) is 9x 2 D, ¬P(x)
2. The negation of 9x 2 D, Q(x) is 8x 2 D, ¬Q(x)

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

,
)
HA
YAH FIXED Cx Cx
o n
2): Ix ED, txt
>
1. 8x 2 D, (x  0) _ (x ,

thx )


2. 9x 2 D, (x < 0) _ (x 2 > 0): ED
,
ex > o ) Nx o

3. 8x 2 D, x2 < x: 7h14 x ) EX ED X 's x TO


Xo D =
,

4. There exists x 2 D such that x 2 < x:

the D
,
xn > x TO
Lecture 3 11/ 16
Multiple Quantifiers

Reminder: Predicates can have multiple arguments

Example: P(x, y ) = (x 2 Z) ^ (y 2 Z) ^ (x · y = 36)


I Evaluate: P(9, 4) = T P( 6, 6) = T P(4, 1) = f
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
Multiple Quantifiers

Reminder: Predicates can have multiple arguments

Example: P(x, y ) = (x 2 Z) ^ (y 2 Z) ^ (x · y = 36)


I Evaluate: P(9, 4) = T P( 6, 6) = TP(4, 1) = F
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 9x 2 Z, 9y 2 Z, x · y = 36 or 9x, y 2 Z, x · y = 36
I For all integers x and y , it is true that x · y = 36
I 8x 2 Z, 8y 2 Z, x · y = 36 or 8x, y 2 Z, x · y = 36

Lecture 3 12/ 16
Mixed Quantifiers

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


I 8x, 9y , P(x, y ): Opponent gives you x, you need to find y
I 9y , 8x, P(x, y ): You need to find y that can handle any
opponent’s x

Lecture 3 13/ 16
Mixed Quantifiers

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


I 8x, 9y , P(x, y ): Opponent gives you x, you need to find y
I 9y , 8x, P(x, y ): You need to find y that can handle any
opponent’s x

Versus ambiguous English sentences


I “For every problem there is a solution” vs “There is a solution
for every problem” same meaning
I Let P(x, y ) = “x is a solution for problem y ”
I 8y , 9x, P(x, y ) vs 9x, 8y , P(x, y )

problem
solution
For
problems there exists a
every ,

There exist a solution that solves all

Lecture 3 13/ 16
Playing the Truth Game

Which of the following are true?

1. 8x 2 Z, 9y 2 Z, x + 2y = 3 ⑦
take 4=2 :

I
implies 2yd
implies y¢
2 thy =3

15 x
⑤ choose y
-
-

2. 8x 2 Z, 9y 2 Z, x + y = 15
-

3. 9y 2 Z, 8x 2 Z, x + y = 15 ④
because
You can't possibly win

first
You go
Lecture 3 14/ 16
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
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
Negating Multiple Quantifiers: Examples

Negate each quantified predicate. Which is true, the


predicate or its negation?

+
-

it true y x but then


-
-

I 8x 2 R>0 , 9y 2 R, (y > x) ^ (x + y = 2x):


> is false ( A)
y
, flex

Jxek.o.V-c.IR
text

)Vlxtytrx)§onisPal€
in
mythic
I 9x 2 Z, 8y 2 Z, x · y  0: ④ Take 1=0

yetU XEII x
if > o
.

, ,

I 8x, y , z 2 Z, x 2 + y 2 + z 2 0 TO

47942220
I xjyp.CI ,

Lecture 3 16/ 16

You might also like