CSE 5731 Lectures 13-14 First-Order Logic CSE 573 Artificial Intelligence I Henry Kautz Fall 2001.

Post on 22-Dec-2015

217 views 3 download

Tags:

transcript

CSE 573 1

Lectures 13-14First-Order LogicLectures 13-14

First-Order Logic

CSE 573

Artificial Intelligence IHenry Kautz

Fall 2001

CSE 573 2

Axiom SchemasAxiom Schemas

Useful to allow schemas that stand for sets of sentences.

• Blowup: (index range)nesting

for i, j in {1, 2, 3, 4} such that adjacent(i,j):

for c in {R, B, G}:

( Xc,i Xc,j)

12 4

3

CSE 573 3

Representing Information about Different Objects

Representing Information about Different Objects

Suppose we want to talk about many different objects…

Where is truck #87? What about airplane #32?

Which vehicle carries package #806?

CSE 573 4

Complex PropositionsComplex Propositions

At( TRUCK87, UW )

At( PLANE32, SEATAC )

In( PACKAGE806, PLANE32 )

Ingredients:

Example of a sentence:

CSE 573 5

Complex TermsComplex Terms

plus(1,3)

4 = 1+3

teacher_of( CSE573, AU2001 )

Overworked(teacher_of(CSE573, AU2001 )) Underpaid(teacher_of(CSE573, AU2001 )))

teacher_of(CSE573, AU2001 ) = HENRY

What is the obvious conclusion?

CSE 573 6

Models of Ground SentencesModels of Ground Sentences

What does entailment mean?

{ Overworked(teacher_of(CSE573, AU2001)),HENRY = teacher_of(CSE573, AU2001)) }

Overworked(HENRY)

CSE 573 7

First Order InterpretationFirst Order Interpretation

1. Domain of objects

2. : Constants 3. : n-ary Function symbols (n )4. : Propositional symbols {true, false}

5. : n-ary Predicate symbols Subsets of n

6. ( “=”) = { (d, d) | d }

CSE 573 8

Do Obvious Recursive Thing!Do Obvious Recursive Thing!

(P(a)) = true iff (a) (P) (Q(a,b)) = true iff ((a), (b)) (Q) (S T) = true iff (S) and (T) (S T) = true iff (S) or (T) (S) = true iff (S) = false

(f(a)) = (f)[(a) ] (f(a,b)) = (f)[(a), (b) ]

CSE 573 9

ExampleExample

Overworked(teacher_of(CSE573, AU2001)) HENRY = teacher_of(CSE573, AU2001))

CSE 573 10

Not Done Yet…Not Done Yet…

So far we’ve provided a way to break propositions down into meaningful bits

• Brings logic closer to the way we think about the world – objects, relationships…

• Doesn’t fundamentally change the expressive or computational properties of propositional logic

• “Naming convention” for propositions

• Inference: same algorithms: Davis-Putnam, GSAT, Resolution

CSE 573 11

Universal StatementsUniversal Statements

Consider:• All men are mortal.

• A parent’s parent is a grandparent.

• No adjacent countries are colored the same color.

CSE 573 12

Universal Statements vs Propositional Schemas

Universal Statements vs Propositional Schemas

1. Do not need to fully instantiate universal statements – more compact.

2. Can use universals in queries, because are real sentences.

3. Can use universals even if you do not have constants to uniquely identify all the objects in the domain.

4. Can use universals to talk about infinite sets

CSE 573 13

SyntaxSyntax

x . = x . x . = x .

x . ( Man(x) Mortal(x) )

x . (Man(x) Mortal(x) )

CSE 573 14

Some Syntactic SugarSome Syntactic Sugar

Vehicle = { TRUCK99, TRUCK33, PLANE66 }shorthand for

Vehicle(TRUCK99) Vehicle(TRUCK33) Vehicle(PLANE66 ) x . (Vehicle(x)

(x= TRUCK99 x= TRUCK33 x= PLANE66 ))

Predicate closure axiomsDomain closure axiom

x . (x= TRUCK99 x= TRUCK33 x= PLANE66 )

CSE 573 15

SemanticsSemantics

A model also maps variables to domain objects: : Variables

x/d = the model that maps “x” to d, but is otherwise just like

( x . ) = true iff

for all d it is the case that x/d () is true

CSE 573 16

Inference in First-Order LogicInference in First-Order Logic

Proof theory:

• Makes the leap from truth and modelsto symbol pushing

Consider a special case:

1. No function symbols

2. Closed domain, or quantify only over closed predicates

CSE 573 17

Grounding Out a First-Order Theory (Special Case)

Grounding Out a First-Order Theory (Special Case)

Vehicle = { TRUCK99, TRUCK33, PLANE66 }

City = { SEATTLE, BOSTON }

x . ( Vehicle(x) ( y . City(y) Based(x, y) ) )

(Based(TRUCK99, SEATTLE) Based(TRUCK99, BOSTON )) (Based(TRUCK33, SEATTLE) Based(TRUCK33, BOSTON )) (Based(PLANE66 , SEATTLE) Based(PLANE66 , BOSTON ))

CSE 573 18

Grounding RulesGrounding Rules

Foo = { F1, F2, … }

x . ( Foo(x) Bar(x))

( Bar(F1) Bar(F2) … )

x . ( Foo(x) Bar(x) )

( Bar(F1) Bar(F2) … )

CSE 573 19

When Grounding is a Bad IdeaWhen Grounding is a Bad Idea

Everyone has friend, all of whose friends drink heavily.

CSE 573 20

Hardness of Full First-Order Logic

Hardness of Full First-Order Logic

Can we always in principle propositionalize a theory?

CSE 573 21

Lifted ResolutionLifted Resolution

• First-order clausal form

• Begin with universal quantifiers

• Rest is a clause

• No existentials, but may include function symbols

( Man(x)Mortal(x)) (Mortal(y)Fallible(y))

(Man(z)Fallible(z))

CSE 573 22

UnificationUnification

Match two literals if:

• Same predicate, one positive, one negative

• Match variable(s) to other vars, constants, or complex terms (function symbols)

(Mortal(HENRY)) (Mortal(y)Fallible(y))

(Fallible(HENRY))

CSE 573 23

Unification with Multiple Variables

Unification with Multiple Variables

You always hurt the ones you love.

Politicians love themselves.

Therefore, politicians hurt themselves.

CSE 573 24

Unification with Function Symbols

Unification with Function Symbols

Say s(x) means the successor of x

s(1) = 2, s(2)=3, etc.

• A number is less than it’s successor.

• “Less than” is transitive.

• Therefore, a number is less than it’s successor’s successor.

CSE 573 25

Unification with Function Symbols

Unification with Function Symbols

(Less(a,s(a))) (Less(b,c) Less(c,d) Less(b,d))

(Less(s(a),d) Less(a,d))

rename variables:

(Less(s(e),f) Less(e,f))

Less(e,s(s(e)))

CSE 573 26

Converting to Clausal Form: Skolem Functions

Converting to Clausal Form: Skolem Functions

Everyone loves someone.x . y . ( Loves(x,y) )

x . ( Loves(x, f33(y)) )

There is somebody whom everyone loves.

y . x . ( Loves(x,y) )

x . ( Loves(x, F99) )

CSE 573 27

Everyone Drinks?Everyone Drinks?

Everyone has friend, all of whose friends drink heavily.

x . y . x . (Friend(x,y) ( Friend(y,z) Drinks(z)))

( Friend(x,f(x) )

( Friend(f(w),z) Drinks(w) )

Conclusion: Everyone drinks heavily.x . ( Drinks(x) )

x . ( Drinks(x) )x . ( Drinks(x) )

Drinks(G)

CSE 573 28

The Case of the Missing AxiomThe Case of the Missing Axiom

( Drinks(G)) ( Friend(f(w),z) Drinks(z) )

Friend(f(w),G)Friend(x,f(x))

Cannot unifiy f(x) and G !

CSE 573 29

Friend is ReflexiveFriend is Reflexive

x ,y . ( Friend(x,y) Friend(y,x) )

CSE 573 30

FOL Refutation ProofFOL Refutation Proof

Drinks(G)

( Friend(f(w),z) Drinks(z) )

Friend(f(w),G)

Friend(x,f(x))

( Friend(a,b) Friend(b,a) )

Friend(f(x),x)

()

CSE 573 31

NextNext

Applications of Logic

• Ontologies

• Reasoning about Change

• Planning