37
Predicates and Quantifiers

Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Embed Size (px)

Citation preview

Page 1: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Predicates and Quantifiers

Page 2: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Predicates (aka propositional functions)

Propositions (things that are true or false) that contain variables

0:)( xxPP(-2) is falseP(42) is trueP(0) is false…

• predicates become propositions (true or false) if• variables are bound with values from domain of discourse U• variables are quantified (more in a minute)

The above predicate, we need to state what values x can take, i.e. what is its domain of discourse?

Let U = Z, the set of integers {…,-2,-1,0,1,2,…}

Page 3: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Predicates (aka propositional functions)

0:)( xxP Let U = Z, the set of integers {…,-2,-1,0,1,2,…}

)0()( PyP Not a proposition. Variable y is unbound

Page 4: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Predicates (aka propositional functions)

zyxzyxR :),,( Let U = Z, the set of integers {…,-2,-1,0,1,2,…}

Put another way: “Let the domain of discourse be the set of all integers”

What is:• R(2,-1,3) ?• R(x,3,z) ?• R(3,6,9) ?

Page 5: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

What is a predicate/propositional function?

• A boolean function, i.e. delivers as a result true or false

• isOdd(x), isEven(x), isMarried(x), isWoman(x) …

• isGreaterThan(x,y)

• sumsToOneHundred(a,b,c,d,e)

• In Claire (a nice language)

• [P(x:integer) : boolean -> x > 3]

• In Claire (a nice language)

• [R(x:integer,y:integer,z:integer) : boolean -> x + y = z]

• isGoingMad(x)

• hasALife(x)

• oddP(x)

Page 6: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false
Page 7: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Some Examples

• [P(x:integer) : boolean -> x > 3]

• [Q(x:integer,y:integer) : boolean -> x + y = 0]

• [R(x:integer,y:integer,z:integer) : boolean -> x + y = z]

• For P, Q, and R universe of discourse (domain) is set of integers

Page 8: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Some Examples

Page 9: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers (universal)

The universal quantifier asserts that a property holds for all values of a variable in a given domain of discourse

“for all”

)(xPx“for all x P(x) holds”

But what’s the domain of discourse? We must state this!

)(xPZxCould also do thisFor all integers, P(x) holds

Page 10: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false
Page 11: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false
Page 12: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false
Page 13: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

)(xPZx

0:)( 2 xxP

Page 14: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers (universal)

)(}3,2,1{ xPx )3()2()1( PPP

Same thing!

AND

Page 15: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers (existential)

The existential quantifier asserts that a property holds for some valuesof a variable in a given domain of discourse

“there exists”

)(xPx “there exists a value of x such that P(x) holds”

But what’s the domain of discourse? We must state this!

)(xPZxCould also do thisThere is an integer value of x such that P(x) holds

Page 16: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers (existential)

)(}3,2,1{ xPx )3()2()1( PPP

Same thing!

OR

Page 17: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

Let the universe of discourse U be the set of real numbers

zxyzyxP :),,(

),,( zyxPzyx

True or false?

So, we can nest quantifiers: example overleaf

Page 18: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

Let the universe of discourse U be the set of integers

yxyxP :),(

),( yxPyx

),( yxPyx

),( yxPyx

),( yxPyx

Nesting: what do these mean?

Page 19: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

yxyxP :),( ),(}4,3{}2,1{ yxPyx

Nesting: what do these mean?

)4,2()3,2()4,1()3,1( PPPP

Page 20: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

yxyxP :),( ),(}4,3{}2,1{ yxPyx

Nesting: what do these mean?

))4,2()3,2(())4,1()3,1(( PPPP

Page 21: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

yxyxP :),( ),(}4,3{}2,1{ yxPyx

Nesting: what do these mean?

))4,2()3,2(())4,1()3,1(( PPPP

),(),( yxPyxyxPyx

Page 22: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers

yxyxP :),( ),(}4,3{}2,1{ yxPyx

Nesting: what do these mean?

))4,2()3,2(())4,1()3,1(( PPPP

Page 23: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Quantifiers and negation

)()( xPxxPx

)()( xPxxPx

Page 24: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Some Examples

• public static boolean P(int x){return x > 3;}

• public static boolean Q(int x, int y){return x + y == 0;}

• public static boolean R(int x, int y, int z){return x + y = z;}

• For P, Q, R universe of discourse (domain) is set of integers

)(xxP),( yxxQy There is no single value of y for this

This is false

),( yxyQx Yip! Y will equal x!

NOTE: sensitivity of order of quantification

Page 25: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Forgive me for misusing java conventions

Page 26: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

),(),( yxxPyyxyPx

),(),( yxxPyyxyPx

That’s okay

Bad Karma!

Beware!

Page 27: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

true!also is y)yP(x,xthen

y) a found we(i.e. trueis y)xP(x,y If

),( that follownot doesit then

trueis ),( If

yxxPy

yxyPx

NOTE!

Page 28: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Examples

• P(x): x is a lion• Q(x): x is fierce• R(x): x drinks coffee• Universe of discourse

• all creatures, great and small

All lions are fierce ))()(( xQxPx

Some lions don’t drink coffee ))()(( xRxPx

Some fierce creatures do not drink coffee ))()(( xRxQx

))()(())()(( xQxPxxQxPx

qpqp

Page 29: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Even more examples

Everyone has a best friend

• B(x,y): x’s best friend is y• Universe of discourse

• people

)),(),(( zxBzyyxBzyx

Yikes!

Page 30: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

When will these examples stop?!

If somebody is a female and she’s a parent then she issomeone’s mother

• F(x): x is a female• P(x): x is a parent• M(x,y): x is the mother of y• Universe of discourse

• people

)),()()(( yxyMxPxFx

Page 31: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Can I think of this stuff in some concrete way?

4,3,2,1 ),( UyxyPx

Okay := truefor x in U while okay do for y in U while okay do okay := P(x,y)okay

Page 32: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Can I think of this stuff in some concrete way?

4,3,2,1 ),( UyxyPx

Okay := truefor x in U while okay do begin okay := false for y in U while not(okay) do okay := P(x,y) endokay

Page 33: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Can I think of this stuff in some concrete way?

4,3,2,1 ),( UyxyPx

Okay := falsefor x in U while not(okay)do begin okay := true for y in U while okay do okay := P(x,y) endokay

Page 34: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Can I think of this stuff in some concrete way?

4,3,2,1 ),( UyxyPx

Okay := falsefor x in U while not(okay)do for y in U while not(okay) do okay := P(x,y)okay

Page 35: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

Non-trivial example: arc-consistency

),,,(}..1{}1{ yjxiconsistentdydxnjni ji

“For any pair of variables (i,j), for all values in the domain ofvariable i there will exist at least one value in the domain of variable jsuch that we can instantiate variable i to the value x andvariable j to the value y and it will be consistent”

32

21

3

2

1

}3,2,1{

}3,2,1{

}3,2,1{

vv

vv

d

d

d

Is this an arc-consistent state?

Page 36: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

3

45

B8 CD

EA

05338

50335

33043

33403

85330

E

D

C

B

A

EDCBA

An min ultrametric tree and its min ultrametric matrix

As we go down a branchvalues on interior nodes increase

Matrix value is the valueof the most recent common ancestor of two leaf nodes

Matrix is symmetric

Page 37: Predicates and Quantifiers. Predicates (aka propositional functions) Propositions (things that are true or false) that contain variables P(-2) is false

ultrametric

)),,((..1..1..1

:])..1][..1[(

jkikij AAAcultrametrikjkijinknjni

nnAcultrametri

yxzzxyzyxzyxcultrametri :),,(

3

45

B8 CD

EA05338

50335

33043

33403

85330

E

D

C

B

A

EDCBA