First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative...

24
First-Order Logic Chapter 8
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    232
  • download

    4

Transcript of First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative...

Page 1: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

First-Order Logic

Chapter 8

Page 2: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

–•

–•

Page 3: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 4: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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, …

Page 5: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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".

Page 6: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

Syntax of FOL: Basic elements

• Constants KingJohn, Richard, 2…

• Predicates Brother, >, Father...

• Functions Sqrt, King,...

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

• Connectives , , , , • Equality =

• Quantifiers ,

Page 7: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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."

Page 8: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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.

Page 9: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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.

Page 10: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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)

Page 11: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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…

Page 12: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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)

Page 13: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 14: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

Models for FOL: Example

Page 15: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 16: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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) ) …

Page 17: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 18: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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!

Page 19: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 20: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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

Page 21: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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.

Page 22: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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.

Page 23: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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)

Page 24: First-Order Logic Chapter 8. Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated.

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.