module #1 - logic 5/16/2015michael frank / kees van deemter1 predicate logic rosen 5 th ed.,...

56
odule #1 - Logic 03/17/22 Michael Frank / Kees van Deemter 1 Predicate Logic Rosen 5 Rosen 5 th th ed., §§1.3-1.4 (but much ed., §§1.3-1.4 (but much extended) extended) ~135 slides, ~5 lectures ~135 slides, ~5 lectures

Upload: aubrey-jones

Post on 17-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 1

Predicate Logic

Rosen 5Rosen 5thth ed., §§1.3-1.4 (but much extended) ed., §§1.3-1.4 (but much extended)~135 slides, ~5 lectures~135 slides, ~5 lectures

Page 2: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 2

Predicate Logic (§1.3)

• We can use propositional logic to prove that We can use propositional logic to prove that certain real-life inferences are valid.certain real-life inferences are valid.– If it’s cold then it snows. If it’s cold then it snows. – If it snows there are accidentsIf it snows there are accidents– It’s not true that there are accidents.It’s not true that there are accidents. Therefore: Therefore:– It’s not coldIt’s not cold

• In propositional logic:In propositional logic:((c((cs s ssa a a) a) c) c) is a tautologyis a tautology

Topic #3 – Predicate Logic

Page 3: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 3

Predicate Logic (§1.3)

• In propositional logic:In propositional logic:(((c(((cs) s) (s(sa) a) a) a) c) c) is a tautologyis a tautology

• Saying this differently,Saying this differently,It follows by propositional logic fromIt follows by propositional logic from((ccs) s) (s(sa) a) aa (premisse) that (premisse) that cc (conclusion) (conclusion)

Topic #3 – Predicate Logic

Page 4: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 4

Predicate Logic (§1.3)

• But other valid inferences cannot be proven But other valid inferences cannot be proven valid by propositional logicvalid by propositional logic– Some girl is adored by everyone. Some girl is adored by everyone. Therefore:Therefore:– Everyone adores someoneEveryone adores someone

• For inferences like this, we need a more For inferences like this, we need a more expressive logicexpressive logic

• Needed: treatment of `some’ and `every’Needed: treatment of `some’ and `every’(analogous to `or’ and `and’)(analogous to `or’ and `and’)

Topic #3 – Predicate Logic

Page 5: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 5

Predicate Logic (§1.3)

• Predicate logicPredicate logic is an extension of is an extension of propositional logic that permits propositional logic that permits quantification over classes of entities.quantification over classes of entities.

• Propositional logic (recall) treats Propositional logic (recall) treats simple simple propositionspropositions (sentences) as atomic entities. (sentences) as atomic entities.

• In contrast, In contrast, predicate predicate logic distinguishes the logic distinguishes the subjectsubject of a sentence from its of a sentence from its predicate.predicate.

Topic #3 – Predicate Logic

Page 6: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 6

Applications of Predicate Logic

It is one of the most-used formal notations It is one of the most-used formal notations for writing mathematical for writing mathematical definitionsdefinitions, , axiomsaxioms, and , and theoremstheorems. .

For example, in For example, in linear algebralinear algebra, a , a partial partial orderorder is introduced saying that a relation R is introduced saying that a relation R is is reflexivereflexive and and transitivetransitive – and these – and these notions are defined using predicate logic.notions are defined using predicate logic.

Topic #3 – Predicate Logic

Page 7: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 7

Practical Applications of Predicate Logic

• Basis for many Artificial Intelligence systems.Basis for many Artificial Intelligence systems.– E.g.E.g. automatic program verification systems. automatic program verification systems.

• Predicate-logic like statements are supported by Predicate-logic like statements are supported by some of the more sophisticated some of the more sophisticated database query database query enginesengines

• There are also limitations associated with using There are also limitations associated with using predicate logic. – More about that laterpredicate logic. – More about that later

Topic #3 – Predicate Logic

Page 8: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 8

First: A bit of grammar

• In the sentence In the sentence ““The dog is sleepingThe dog is sleeping””::– The phrase The phrase ““the dogthe dog”” denotes the denotes the subjectsubject - -

which the sentence is about.which the sentence is about.– The phrase The phrase ““is sleepingis sleeping”” denotes the denotes the predicatepredicate- -

a property that is true a property that is true ofof the subject. the subject.

• Predicate logic follows broadly the same Predicate logic follows broadly the same pattern. pattern.

Topic #3 – Predicate Logic

Page 9: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 9

Formulas of predicate logic (informal)

• We will useWe will use various kinds of individual various kinds of individual constantsconstants thatthat denote individuals/objects: denote individuals/objects: a,b,c,…a,b,c,…

Constants Constants are a bit likeare a bit like names names• Individual variablesIndividual variables over objects: over objects: xx, , yy, , zz , …, …• The The result ofresult of applyingapplying a predicate a predicate PP to a to a

constant constant aa is the proposition is the proposition PP(a)(a)Meaning: the object denoted by Meaning: the object denoted by aa has the property has the property denoted by denoted by PP..

Topic #3 – Predicate Logic

Page 10: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 10

Formulas of predicate logic (informal)

• The The result ofresult of applyingapplying a predicate a predicate PP to a to avariable x is the variable x is the propositional propositional formform P P(x).(x).– E.g.E.g. if if P P = = ““is a prime numberis a prime number””, then , then

PP(x) is the (x) is the propositionalpropositional formform ““x is a prime numberx is a prime number””. .

Topic #3 – Predicate Logic

Page 11: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 11

Predicates/relations with n places

• Predicate logic Predicate logic generalisesgeneralises the notion of a the notion of a predicate to include propositional functions predicate to include propositional functions of of anyany number of arguments. E.g.: number of arguments. E.g.:

R(R(xx,,yy) = ) = ““x adores yx adores y””

PP((xx,,y,zy,z) = ) = ““x x gavegave y y the gradethe grade z z””

Q(x,y,z,uQ(x,y,z,u)= “ )= “ x*(y+z)=u ”x*(y+z)=u ”

Topic #3 – Predicate Logic

Page 12: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 12

Universes of Discourse (U.D.s)

• Predicate Logic lets you state things about Predicate Logic lets you state things about manymany objects at once, using objects at once, using quantifiersquantifiers

• E.g., let E.g., let PP((xx) = ) = ““ ( (xx*2) *2) x x ””. We can then say,. We can then say,““For For anyany number number xx, , PP((xx) is true) is true”” instead of instead of((00*2 *2 00) ) ( (11*2 *2 11)) ( (22*2 *2 22)) ... ...

• The collection of values that a variable The collection of values that a variable xx can take can take is called is called xx’’s s universe of discourseuniverse of discourse

Topic #3 – Predicate Logic

Page 13: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 13

Universes of Discourse (U.D.s)

• In a finite U.D., quantifiers can be replaced by In a finite U.D., quantifiers can be replaced by ,,• E.g., if the domain is all the members of the House E.g., if the domain is all the members of the House

of Commons, then it is equivalent to sayof Commons, then it is equivalent to say1. For any person x, x has a consituency1. For any person x, x has a consituency

2. D.Cameron has a constituency 2. D.Cameron has a constituency E.Miliband has a constituency, E.Miliband has a constituency, … … MP nr. 650 has a constituency MP nr. 650 has a constituency

• For an infinite U.D. this is not true unless we For an infinite U.D. this is not true unless we allow infinite conjunctions and disjunctionsallow infinite conjunctions and disjunctions

Topic #3 – Predicate Logic

Page 14: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 14

Universes of Discourse (U.D.s)

• A statement can be true in one U.D. and A statement can be true in one U.D. and false in anotherfalse in another

• E.g., let E.g., let PP((xx)=)=““xx*2 *2 xx””, then, then– ““For For anyany number number xx, , PP((xx) is true) is true”” is is truetrue

when U.D. = when U.D. = NN– ““For For anyany number number xx, , PP((xx) is true) is true”” is is falsefalse

when U.D. = when U.D. = ZZ

Topic #3 – Predicate Logic

Page 15: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 15

Back to propositional logic

• In propositional logic, we could not simply In propositional logic, we could not simply say whether a formula is TRUE; what we say whether a formula is TRUE; what we could say is whether it is TRUE with could say is whether it is TRUE with respect to a given assignment of respect to a given assignment of TRUE/FALSE to the Atoms in the formulaTRUE/FALSE to the Atoms in the formula

• E.g., E.g., ppq q is TRUE with respect to the is TRUE with respect to the assignment assignment pp=TRUE, =TRUE, qq=TRUE=TRUE

Page 16: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 16

Predicate logic

• In predicate logic, we say that a formula is TRUE In predicate logic, we say that a formula is TRUE (FALSE) with respect to a (FALSE) with respect to a modelmodel

• Model = u.d. plus specification of the “meanings” Model = u.d. plus specification of the “meanings” of the predicates. This can be done e.g.of the predicates. This can be done e.g.– by giving an English equivalent of a predicateby giving an English equivalent of a predicate– by listing explicitly which objects by listing explicitly which objects

the predicate is true ofthe predicate is true of• ... as long the ... as long the extensionextension of the predicate is clear. of the predicate is clear.

(By definition, this is (By definition, this is the set of objects in the u.d. the set of objects in the u.d. for which the predicate holdsfor which the predicate holds.).)

Page 17: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 17

These ideas formalised

• ““”” is the FORis the FORLL or LL or universaluniversal quantifier. quantifier. ““”” is the is the XISTS or XISTS or existentialexistential quantifier. quantifier.

• For example, For example, xx PP((xx) and ) and x Px P((xx)) are are propositionspropositions

Topic #3 – Predicate Logic

Page 18: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 18

Meaning of Quantified Expressions

First, informally:First, informally:

xx PP((xx) means ) means for allfor all x in the u.d., x in the u.d., PP holds. holds.

x Px P((xx) means ) means there there exist exist xx in the u.d. (that in the u.d. (that is, 1 or more) is, 1 or more) such thatsuch that PP((xx) is true.) is true.

Topic #3 – Predicate Logic

Page 19: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 19

Example:

Let the u.d. be Let the u.d. be the parking spaces at UFthe parking spaces at UF..Let Let PP((xx) mean ) mean ““xx is full. is full.””Then the Then the existential quantification of Pexistential quantification of P((xx), ), xx PP((xx), is the proposition saying that), is the proposition saying that– ““Some parking spaces at UF are full.Some parking spaces at UF are full.””– ““There is a parking space at UF that is full.There is a parking space at UF that is full.””– ““At least one parking space at UF is full.At least one parking space at UF is full.””

Topic #3 – Predicate Logic

Page 20: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 20

Example:

Let the u.d. be Let the u.d. be parking spaces at UFparking spaces at UF..Let Let PP((xx) be the ) be the prop. formprop. form ““xx is occupied is occupied””Then the Then the universal quantification of Puniversal quantification of P((xx), ), xx PP((xx), is the proposition), is the proposition::– ““All parking spaces at UF are occupied.All parking spaces at UF are occupied.””– ““For each parking space at UF, that space is full.For each parking space at UF, that space is full.””

Topic #3 – Predicate Logic

Page 21: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 21

Syntax of predicate logic (for 1- and 2-place predicates)

• Variable: x,y,z,… Constants: a,b,c,…Variable: x,y,z,… Constants: a,b,c,…• 1-place predicates: P,Q,…1-place predicates: P,Q,…• 2-place predicates: R,S,…2-place predicates: R,S,…• Atomic formulas: Atomic formulas:

If If is a 1-pace predicate and is a 1-pace predicate and a variable or a variable or constant then constant then (() is an atomic formula.) is an atomic formula.

If If is a 2-pace predicate and is a 2-pace predicate and and and are are variables or constants then variables or constants then ((,,) is an atomic ) is an atomic formula.formula.

Page 22: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 22

Syntax of predicate logic (for 1- and 2-place predicates)

(Wellformed) Formulas: (Wellformed) Formulas:

• All atomic formulas are formulasAll atomic formulas are formulas• If If and and are formulas then are formulas then ,,

( ( ), (), (), (), ( ) are formulas.) are formulas.• If If is a formula then is a formula then x x and and x x

are are formulas. (Likewise, formulas. (Likewise, y y and and yy ,,and so on.)and so on.)

Page 23: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 23

Syntax of predicate logic (for 1- and 2-place predicates)

Show that these are wellformed formulas:Show that these are wellformed formulas:

xP(x) xP(x) yQ(x) yQ(x) xxy R(x,y) y R(x,y) xP(b)xP(b)

Page 24: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 24

Syntax of predicate logic (for 1- and 2-place predicates)

xP(x) xP(x) yQ(x) yQ(x) xxy R(x,y) y R(x,y) xP(b)xP(b)

• P(x) is a (atomic) formula, hence P(x) is a (atomic) formula, hence xP(x)xP(x) is a formula is a formula

• Q(x) is a (atomic) formula, hence Q(x) is a (atomic) formula, hence yQ(x)yQ(x) is a formula is a formula

• R(x,y) is a (atomic) formula, hence R(x,y) is a (atomic) formula, hence y R(x,y) is a y R(x,y) is a formula, hence formula, hence xxy R(x,y)y R(x,y) is a formula is a formula

• P(b) is a (atomic) formula, hence P(b) is a (atomic) formula, hence xP(b)xP(b) is a formula is a formula

Page 25: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 25

Syntax of predicate logic (for 1- and 2-place predicates)

• Examples: Examples: xP(x)xP(x) and and yQ(x),yQ(x), xx((y Ry R((x,yx,y)), )), xx((x Rx R((x,yx,y)),)), xP(b)xP(b) etc.etc.

• Lots of Lots of pathologicalpathological cases. For example, cases. For example,– It will follow from the meaning of these It will follow from the meaning of these

formulas thatformulas that xP(b)xP(b) is true iff is true iff P(b) P(b) is trueis true– Rule of thumb: a quantifier that does not bind Rule of thumb: a quantifier that does not bind

any variables can be ignoredany variables can be ignored

Page 26: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 26

Free and Bound Variables

• An expression like An expression like PP((xx) is said to have a ) is said to have a free variablefree variable x x (i.e., (i.e., xx is not is not ““defineddefined””).).

• A quantifier (either A quantifier (either or or ) ) operatesoperates on an on an expression having one or more free expression having one or more free variables, and variables, and bindsbinds one or more of those one or more of those variables, to produce an expression having variables, to produce an expression having one or more one or more boundbound variablesvariables..

Topic #3 – Predicate Logic

Page 27: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 27

Example of Binding

• PP((x,yx,y) has 2 free variables, ) has 2 free variables, xx and and yy..xx PP((xx,,yy) has 1 free variable, and one ) has 1 free variable, and one

bound variable. bound variable. [Which is which?][Which is which?]• An expression with An expression with zerozero free variables is a free variables is a

statement / proposition.statement / proposition.• An expression with An expression with one one free variable is free variable is

similar to a predicate: similar to a predicate: e.g.e.g. let let QQ((yy) = ) = xx Adore( Adore(xx,,yy))

Topic #3 – Predicate Logic

Page 28: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 28

Free variables, defined formally

• The free-variable occurrences in an The free-variable occurrences in an AtomAtom are: all are: all the variable occurrences in that Atomthe variable occurrences in that Atom

• The free-variable occurrences in The free-variable occurrences in are: the free- are: the free-variable occurrences in variable occurrences in

• The free-variable occurrences in The free-variable occurrences in (( connective connective )) are: the free-variable occurrences are: the free-variable occurrences in in plus the free-variable occurrences in plus the free-variable occurrences in

• The free-variable occurrences in The free-variable occurrences in xx and and xx are: the free-variable occurrences in are: the free-variable occurrences in except for except for all/any occurrences of all/any occurrences of xx..

Topic #3 – Predicate Logic

Page 29: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 29

• Occurrences of variables that are not free are Occurrences of variables that are not free are boundbound..

• Test your understanding: Which (if any) variables Test your understanding: Which (if any) variables are free in are free in x x PP((xx))x x PP((xx))yQ(x)yQ(x)xP(b) (NB, b is a constant)xP(b) (NB, b is a constant)xx((y Ry R((x,yx,y))))

Page 30: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 30

• Occurrences of variables that are not free Occurrences of variables that are not free are are boundbound..

• Check your understanding: Which (if any) Check your understanding: Which (if any) variables are free in variables are free in x x PP((xx) ) [no free variables][no free variables]x x PP((xx) ) [no free variables][no free variables]yQ(x) yQ(x) [x is free][x is free]xP(b) (NB, b is a constant) xP(b) (NB, b is a constant) [no free var.][no free var.]xx((y Ry R((x,yx,y)) )) [no free variables][no free variables]

Page 31: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 31

A more precise definition of the truth/falsity of quantified formulas

• (Formulation is simplified somewhat because (Formulation is simplified somewhat because we assume that every object in the u.d. D has we assume that every object in the u.d. D has a `name` (i.e., a constant referring to it)).a `name` (i.e., a constant referring to it)).

• First some notation: First some notation: ((xx:=:=aa)) is the result of is the result of substituting all substituting all free occurrences of the free occurrences of the variable variable xx in in by the constant by the constant aa

Topic #3 – Predicate Logic

Page 32: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 32

Exercise

Say whatSay what ((xx:=:=aa) ) is, if is, if ==– P(x)P(x)– R(x,y)R(x,y)– P(b)P(b) x x PP((xx)) yQ(x)yQ(x)

Topic #3 – Predicate Logic

Page 33: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 33

Exercise

Say whatSay what ((xx:=:=aa) ) is, if is, if ==– P(x) ..... P(P(x) ..... P(aa))– R(x,y) .... R(R(x,y) .... R(aa,y),y)– P(b) ..... P(b)P(b) ..... P(b) x x PP((xx) ...... ) ...... x x PP((xx)) yQ(x) ...... yQ(x) ...... yQ(yQ(aa))

Topic #3 – Predicate Logic

Page 34: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 34

A more precise definition of the truth/falsity of quantified formulas

• (Formulation is simplified somewhat because (Formulation is simplified somewhat because we assume that every object in the u.d. has we assume that every object in the u.d. has a `name` (i.e., a constant referring to it)).a `name` (i.e., a constant referring to it)).

• Let Let be a formula. Then be a formula. Then xx is true in D is true in D if if at least oneat least one expression of the form expression of the form ((xx:=:=aa) is true in D, and false otherwise. ) is true in D, and false otherwise. ((aa can be any constant) can be any constant)

Topic #3 – Predicate Logic

Page 35: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 35

A more precise definition

• Let Let be a formula. Then be a formula. Then xx is true in D is true in D if if at least oneat least one expression expression ((xx:=:=aa) is true in ) is true in D, and false otherwise.D, and false otherwise.

• A simple example: A simple example: = P(x)= P(x)

P(x) is a formula, hence P(x) is a formula, hence x Px P((xx) is true in D ) is true in D if at least one expression of the form if at least one expression of the form P(a)P(a) is is true in D, and false otherwise.true in D, and false otherwise.

Topic #3 – Predicate Logic

Page 36: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 36

Similarly for

• Let Let be a formula. Then the proposition be a formula. Then the proposition xx is true in D if every expression of the is true in D if every expression of the form form ((xx:=:=aa) is true in D, and false ) is true in D, and false otherwise.otherwise.

• A simple example: A simple example: = = P(x)P(x)

P(x)P(x) is a formula, hence is a formula, hence x Px P((xx) is true in ) is true in D if every expression D if every expression P(a)P(a) is true in D, and is true in D, and false otherwise.false otherwise.

Topic #3 – Predicate Logic

Page 37: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 37

Complex formulas

Example: Let the u.d. of Example: Let the u.d. of xx and and yy be people. be people.

Let Let LL((xx,,yy)=)=““x x likes likes yy”” (a predicate w. 2 f.v.(a predicate w. 2 f.v.’’s)s)

Then Then y Ly L((x,yx,y) = ) = ““There is someone whom There is someone whom xx likes.likes.”” (A predicate w. 1 free variable, (A predicate w. 1 free variable, xx))

Then Then xx ( (y Ly L((x,yx,y)) =)) = ““Everyone has someone whom they like.Everyone has someone whom they like.””

(a real proposition; no free variables left)(a real proposition; no free variables left)

Topic #3 – Predicate Logic

Page 38: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 38

Consequences of Binding (work out for yourself by checking when each formula is true)

xx x Px P((xx)) - - xx is not a free variable in is not a free variable in x Px P((xx), therefore the ), therefore the xx binding binding isnisn’’t used,t used,as it were.as it were.

• ((xx PP((xx)))) Q( Q(xx)) - The variable - The variable xx is outside is outside of the of the scopescope of the of the x x quantifier, and is quantifier, and is therefore free. Not a complete proposition!therefore free. Not a complete proposition!

• ((xx PP((xx)))) ((x x Q(Q(xx)))) – A complete – A complete proposition, and no superfluous quantifiersproposition, and no superfluous quantifiers

Topic #3 – Predicate Logic

Page 39: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 39

Nested quantifiers

Assume Assume S(x,y)S(x,y) means “ means “xx sees sees yy””

u.d.=all peopleu.d.=all people

What does the following formula mean?What does the following formula mean?

xSxS((x,ax,a))

Page 40: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 40

Nested quantifiers

Assume Assume S(x,y)S(x,y) means “ means “xx sees sees yy”. ”.

u.d.=all peopleu.d.=all people

xSxS((x,ax,a) means ) means ““For every For every xx, , xx sees sees aa””

In other words,In other words,““Everyone sees Everyone sees aa””

Page 41: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 41

Nested quantifiers

What does the following formula mean?What does the following formula mean?

xx((y Sy S((x,yx,y))))

Page 42: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 42

Nested quantifiers

xx((y Sy S((x,yx,y)) means )) means ““For every For every xx, there exists , there exists a a yy such that such that xx sees sees y”y”

In other words: In other words: “Everyone sees someone”“Everyone sees someone”

Page 43: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 43

Quantifier Exercise

If If RR((xx,,yy)=)=““xx relies upon relies upon yy,,”” express the express the following in unambiguous English:following in unambiguous English:

xx((y Ry R((x,yx,y))=))=

yy((xx RR((x,yx,y))=))=

xx((y Ry R((x,yx,y))=))=

yy((x Rx R((x,yx,y))=))=

xx((y Ry R((x,yx,y))=))=

Everyone has someone to rely on.

There’s a poor overburdened soul whom everyone relies upon (including himself)!There’s some needy person who relies upon everybody (including himself).

Everyone has someone who relies upon them.

Everyone relies upon everybody, (including themselves)!

Topic #3 – Predicate Logic

Page 44: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 44

Quantifier Exercise

RR((xx,,yy)=)=““xx relies upon relies upon yy””. Suppose the u.d. is. Suppose the u.d. isnot empty. Now not empty. Now consider these formulas:consider these formulas: xx((y Ry R((x,yx,y)))) yy((xx RR((x,yx,y)))) xx((y Ry R((x,yx,y))))Which of them is most informative?Which of them is most informative?Which of them is least informative?Which of them is least informative?

Topic #3 – Predicate Logic

Page 45: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 45

Quantifier Exercise

(Recall: the u.d. is (Recall: the u.d. is not emptynot empty. Empty u.d.’s are . Empty u.d.’s are discussed later.)discussed later.)

1.1. xx((y Ry R((x,yx,y)) Least informative)) Least informative2.2. yy((xx RR((x,yx,y))))3.3. xx((y Ry R((x,yx,y)) Most informative)) Most informativeIf 3 is true then 2 must also be true.If 3 is true then 2 must also be true.If 2 is true then 1 must also be true.If 2 is true then 1 must also be true.

We say: 3 is logically We say: 3 is logically stronger stronger than 2 than 1than 2 than 1

Topic #3 – Predicate Logic

Page 46: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 46

“logically stronger than”

• General: General: is logically stronger than is logically stronger than iff iff – it is not possible for it is not possible for to be true and to be true and false false– it is possible for it is possible for to be true and to be true and false false

• E.g. E.g. = John is older than 30, = John is older than 30, = John is older than 20. = John is older than 20.

• We write ‘iff’ for ‘if and only if’We write ‘iff’ for ‘if and only if’

Page 47: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 47

Natural language is ambiguous!

• ““Everybody likes somebody.Everybody likes somebody.””– For everybody, there is somebody they like,For everybody, there is somebody they like,

xx yy LikesLikes((xx,,yy))

– or, there is somebody (a popular person) whom or, there is somebody (a popular person) whom everyone likes?everyone likes?yy xx LikesLikes((xx,,yy))

[Probably more likely.]

Topic #3 – Predicate Logic

Page 48: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 48

Interactions between quantifiers and connectives

Let the u.d. be Let the u.d. be parking spaces at UFparking spaces at UF..Let Let PP((xx) be ) be ““xx is occupied. is occupied.””Let Q(Let Q(xx) be ) be ““xx is free of charge. is free of charge.”” x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))) ) x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))))

Page 49: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 49

I. Construct English paraphrases

Let the u.d. be Let the u.d. be parking spaces at UFparking spaces at UF..Let Let PP((xx) be ) be ““xx is occupied. is occupied.””Let Q(Let Q(xx) be ) be ““xx is free of charge. is free of charge.”” x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))) ) x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))))

Page 50: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 50

I. Construct English paraphrases

1.1. x x ((QQ((xx) ) PP((xx))) Some places are free of ) Some places are free of charge and occupiedcharge and occupied

2.2. x x ((QQ((xx) ) PP((xx))) All places are free of ) All places are free of charge and occupied charge and occupied

3.3. x x ((QQ((xx) ) PP((xx))) All places that are free ) All places that are free of charge are occupiedof charge are occupied

4.4. x x ((QQ((xx) ) PP((xx))) For some places x, if x ) For some places x, if x is free of charge then x is occupied is free of charge then x is occupied

Page 51: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 51

About the last of these

4. 4. x x ((QQ((xx) ) PP((xx))) ) ““For some x, if x is free of For some x, if x is free of charge then x is occupiedcharge then x is occupied””

x x ((QQ((xx) ) PP((xx))) ) is true iff, for some place a, is true iff, for some place a, QQ((aa) ) PP((aa) is true.) is true.

QQ((aa) ) PP((aa)) is true iffis true iff QQ((aa) is false ) is false andand//oror PP((aa) is true ) is true (conditional is only false in one row of table!)(conditional is only false in one row of table!)

““Some places are either (not free of charge) Some places are either (not free of charge) and/or occupiedand/or occupied””

Page 52: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 52

About the last of these

4.4. x x ((QQ((xx) ) PP((xx))) ) When confused by a When confused by a conditional: re-write it using conditional: re-write it using negationnegation and and disjunctiondisjunction::

x x ((QQ((xx) ) PP((xx))) ) (p. 67)(p. 67)

x x QQ((xx)) x Px P((xx)) ““Some places are Some places are not free of charge or some places are not free of charge or some places are occupiedoccupied””

Page 53: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 53

• Combinations to remember:Combinations to remember:

1.1. x x ((QQ((xx) ) PP((xx))))

2.2. x x ((QQ((xx) ) PP((xx))))

Page 54: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 54

II. Construct a model where 1 and 4 are true, while 2 and 3 are false

Let the u.d. be Let the u.d. be parking spaces at UFparking spaces at UF..Let Let PP((xx) be ) be ““xx is occupied. is occupied.””Let Q(Let Q(xx) be ) be ““xx is free of charge. is free of charge.”” x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))) ) x x ((QQ((xx) ) PP((xx)))) x x ((QQ((xx) ) PP((xx))))

Page 55: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 55

II. Construct a model where 1 and 4 are true, while 2 and 3 are false

1.1. x x ((QQ((xx) ) PP((xx))) (true for place a below)) (true for place a below)2.2. x x ((QQ((xx) ) PP((xx))) (false for places b below)) (false for places b below)3.3. x x ((QQ((xx) ) PP((xx))) (false for place b below)) (false for place b below)4.4. x x ((QQ((xx) ) PP((xx))) (true for place a below)) (true for place a below)One solutionOne solution: a model with exactly two objects in it. : a model with exactly two objects in it.

One object has the property Q and the property One object has the property Q and the property P; the other object has the property Q but not the P; the other object has the property Q but not the property P. In a diagram: property P. In a diagram:

a: Q P b: Q not-Pa: Q P b: Q not-P

Page 56: Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§1.3-1.4 (but much extended) ~135 slides, ~5 lectures

Module #1 - Logic

04/18/23 Michael Frank / Kees van Deemter 56

III. Construct a model where 1 and 3 and 4 are true, but 2 is false

1.1. x x ((QQ((xx) ) PP((xx))) ) 2.2. x x ((QQ((xx) ) PP((xx))) ) 3.3. x x ((QQ((xx) ) PP((xx))) ) 4.4. x x ((QQ((xx) ) PP((xx))))

Here is such a model (using a diagram). It has just Here is such a model (using a diagram). It has just two objects in its u.d., called a and b:two objects in its u.d., called a and b:

a: Q P b: not-Q Pa: Q P b: not-Q P