first-order logic chapter 8. pros and cons of propositional logic propositional logic is declarative...

Post on 19-Dec-2015

232 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

First-Order Logic

Chapter 8

Pros and cons of propositional logic

Propositional logic is declarative Propositional logic allows partial/disjunctive/negated

information– (unlike most data structures and databases)

Propositional logic is compositional:– meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2

Meaning in propositional logic is context-independent– (unlike natural language, where meaning depends on context)

Propositional logic has very limited expressive power– (unlike natural language)– E.g., cannot say "pits cause breezes in adjacent squares“

• except by writing one sentence for each square

–•

–•

What you should know in Ch. 7

• Pros & Cons of Prop. Logics• Logical connectives rules• Ability to manipulate logic statements into

alternate forms• Horn Clauses• Basics of Logical Agents• Boolean logic => circuits• Forward & backward chaining

First-order logic

• Whereas propositional logic assumes the world contains facts,

• first-order logic (like natural language) assumes the world contains– Objects: people, houses, numbers, colors,

baseball games, wars, …– Relations: red, round, prime, brother of,

bigger than, part of, comes between, …– Functions: father of, best friend, one more

than, plus, …

Logic What Exists in World Knowledge States

Propositional facts true/false/unknown

First-Order facts, objects,relations

true/false/unknown

Temporal facts, objects, relations, times

true/false/unknown

Probability Theory

facts degree of belief 0..1

Fuzzy facts degree of truth 0..1

Logics

• Logics are characterized by what they commit to as "primitives".

Syntax of FOL: Basic elements

• Constants KingJohn, Richard, 2…

• Predicates Brother, >, Father...

• Functions Sqrt, King,...

• Variables x, y, a, b,...

• Connectives , , , , • Equality =

• Quantifiers ,

Sentences in FOL

What does the following FOL sentence mean?

x [Person(x) t (Time(t) Fool(x,t))] t [Time(t) x (Person(x) Fool(x,t))] t,x [Time(t) Person(x) Fool(x,t)]

• Abraham Lincoln:"If you once forfeit the confidence of your fellow citizens, you can never regain their respect and esteem. It is true that you may fool some of the people all of the time; you can even fool all of the people some of the time, but you can’t fool all of the people all of the time."

FOL: Syntax

• FOL fixes problems with PL:– PL doesn’t have variables.

FOL does.– Identifying individuals in PL is hard.

FOL it’s easy.– PL can't directly express properties of individuals

or relations between individuals.FOL can.

• Inferencing in PL is fairly easy.In FOL it is more complicated.

FOL: Terms

• A term denotes an object in the world.– Constant: JohnPaxton, 2, Bozeman, …– Variable: x, y, a, b, c, …

– Function(Term1, …, Termn):

Sqrt(9),

Distance(Bozeman,Missoula)• is a relation for which there is one answer• maps one or more objects to another single object• can refer to an unnamed object: e.g. Car(Neal)• represents a model/user defined functional relation

• A ground term is a term with no variables.

FOL: Atoms

• An atom/literal is smallest expressionto which a truth value can be assigned.

– Predicate(Term1, …, Termn):Teacher(John, Neal) • maps one or more objects to a truth value• represents a model/user defined truth relation

– Term1 = Term2:Car(Neal) = GMC_TruckCar(Neal) = InGarage(Neal)• represents the equality relation

when two terms refer to the same object• is a predicate in prefix form: =(Term1, Term2)

FOL: Sentences

• A sentence represents a fact in the worldthat is assigned a truth value.

– atom– complex sentence using connectives:

Advisor(John,Neal)

Student(Neal) ^ Teacher(John)

– complex sentence using quantified variables: more in a bit…

FOL: Complex sentences

• Complex sentences are made from atomic sentences using connectives

S, S1 S2, S1 S2, S1 S2, S1 S2,

Brother(Richard, John) Brother(John,Richard)

King(Richard) V King(John)

King(Richard) => King(John)

FOL: Models & Interpretation

Sentences are assigned a truth valuewith respect to a model and an interpretation.

• The model contains the objectsand the relations among them.– the domain of a model is the set of objects it contains

• The interpretation specifieswhat the symbols refer to:– constants symbols refer to objects– predicate symbols refer to truth relations– functional symbols refer to functional relations

Models for FOL: Example

FOL: Universal Quantifiers

Universal quantifier: <variables> <sentence>

Means the sentence holds truefor all values of x in the domain of variable x.

• Main connective typically forming if-then rules– All humans are mammals. Becomes what in FOL?x Human(x) Mammal(x)

for all x if x is a human then x is a mammal

– Mammals must have fur. Becomes what in FOL?

x Mammal(x) HasFur(x)for all x if x is a mammal then x has fur

FOL: Using Univ. Quantifiersx Human(x) Mammal(x)

• Equivalent to conjunction of instantiations of x:(Human(Neal) Mammal(Neal)) (Human(John) Mammal(John)) (Human(22) Mammal(22) ) …

• Common mistake is to use as main connective.– results in a blanket statement about everything

• Bad example "x Human(x) ^ Smart(x)" means?– everything is human and a mammal

(Human(Neal) Smart(Neal)) (Human(John) Smart(John)) (Human(GMC_TRUCK) Smart(GMC_Truck) ) …

FOL: Existential Quantifiers

Existential quantifier: <variables> <sentence>

Means the sentence holds truefor some value of x in the domain of variable x.

• Main connective typically – Some humans are old.x Human(x) Old(x) there exist an x such that x is a human and x is old

– Mammals may have arms.x Mammal(x) HasArms(x) there exist an x such that x is a mammal and x has arms

FOL: Using Exist. Quantifiersx Human(x) Old(x)

• Equivalent to disjunction of instantiations of x:(Human(Neal) Old(Neal)) (Human(John) Old(John)) (Human(22) Old(22) ) …

• Common mistake is to use as main connective.– results in a weak statement

• Bad example “x Human(x) Old(x)” means?– true if there is anything that isn't human

(Human(Neal) Old(Neal)) (Human(John) Old(John)) (Human(22) Old(22) ) … 22 not human!

FOL Syntax: Quantifiers

xy Likes(x,y) Is what in English?

Everyone likes everyone. It’s the active voice.

yx Likes(x,y) Is what in English?

Everyone is liked by everyone. It’s the passive voice.

Do these mean the same thing?

• Property of quantifiers: xy is the same as yx xy is the same as yx– note: xy can be written as xy, likewise with

FOL Syntax: Quantifiers

xy Likes(x,y) Is what in English?

Everyone likes someone. again the active voice

yx Likes(x,y) Is what in English?

Someone is liked by everyone. again the passive voice

Do these mean the same thing?

• Property of quantifiers: xy is not the same as yx xy is not the same as yx

FOL Syntax: Quantifiers x Likes(x,IceCream)

Everyone likes ice cream.

x Likes(x,IceCream)No one doesn't like ice cream. It's a double negative!

Do these mean the same thing?

• Properties of quantifiers: x P(x) is the same as x P(x) x P(x) is the same as x P(x)– This is the negation of the application of

de Morgan's law to the fully instantiated sentence.

FOL Syntax: Quantifiers

x Likes(x,IceCream) Everyone likes ice cream.

What is the logical negation of this sentence?

Not everyone likes ice cream. which is the same as…

x Likes(x,IceCream) Someone doesn't like ice cream.

• Properties of quantifiers:– x P(x) when negated is x P(x)– x P(x) when negated is x P(x)– This is from the application of de Morgan's law

to the fully instantiated sentence.

DeMorgan’s and Quantifiers

x P(x) x P(x) P ^Q P VQ)

x P(x) x P(x) P ^ Q) P VQ)

x P(x) x P(x) P ^ Q P VQ)

x P(x) x P(x) P VQ P ^Q)

Summary

• First-order logic:– objects and relations are semantic primitives– syntax: constants, functions, predicates,

equality, quantifiers

• Increased expressive power: sufficient to define wumpus world more concisely.

top related