Lectures 13-14 First-Order Logic
310 likes | 408 Vues
Explore the basics of first-order logic, including propositions, terms, interpretation, models, syntax, semantics, and inference. Dive into universal statements and learn about syntactic sugar, semantics, grounding rules, and unification in this introductory guide.
Lectures 13-14 First-Order Logic
E N D
Presentation Transcript
Lectures 13-14First-Order Logic CSE 573 Artificial Intelligence I Henry Kautz Fall 2001 CSE 573
Axiom 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) 3 4 2 1 CSE 573
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
Complex Propositions • At( TRUCK87, UW ) • At( PLANE32, SEATAC ) • In( PACKAGE806, PLANE32 ) • Ingredients: • Example of a sentence: CSE 573
Complex 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
Models of Ground Sentences • What does entailment mean? • { Overworked(teacher_of(CSE573, AU2001)),HENRY = teacher_of(CSE573, AU2001)) } • Overworked(HENRY) CSE 573
First Order Interpretation • Domain of objects • : Constants • : n-ary Function symbols (n ) • : Propositional symbols {true, false} • : n-ary Predicate symbols Subsets of n • ( “=”) = { (d, d) | d} CSE 573
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
Example • Overworked(teacher_of(CSE573, AU2001)) HENRY = teacher_of(CSE573, AU2001)) CSE 573
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
Universal Statements • Consider: • All men are mortal. • A parent’s parent is a grandparent. • No adjacent countries are colored the same color. CSE 573
Universal Statements vs Propositional Schemas • Do not need to fully instantiate universal statements – more compact. • Can use universals in queries, because are real sentences. • Can use universals even if you do not have constants to uniquely identify all the objects in the domain. • Can use universals to talk about infinite sets CSE 573
Syntax x . = x . x . = x . • x . ( Man(x) Mortal(x) ) • x . (Man(x) Mortal(x) ) CSE 573
Some 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 axioms Domain closure axiom • x . (x= TRUCK99 x= TRUCK33 x= PLANE66 ) CSE 573
Semantics • 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
Inference in First-Order Logic • Proof theory: • Makes the leap from truth and modelsto symbol pushing • Consider a special case: • No function symbols • Closed domain, or quantify only over closed predicates CSE 573
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
Grounding Rules • Foo = { F1, F2, … } • x . ( Foo(x) Bar(x)) ( Bar(F1) Bar(F2) … ) • x . ( Foo(x) Bar(x) ) ( Bar(F1) Bar(F2) … ) CSE 573
When Grounding is a Bad Idea • Everyone has friend, all of whose friends drink heavily. CSE 573
Hardness of Full First-Order Logic • Can we always in principle propositionalize a theory? CSE 573
Lifted 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
Unification • Match two literals if: • Same predicate, one positive, one negative • Match variable(s) to other vars, constants, or complex terms (function symbols) (Mortal(y)Fallible(y)) (Mortal(HENRY)) (Fallible(HENRY)) CSE 573
Unification with Multiple Variables • You always hurt the ones you love. • Politicians love themselves. • Therefore, politicians hurt themselves. CSE 573
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
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
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
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
The 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
Friend is Reflexive • x ,y . ( Friend(x,y) Friend(y,x) ) CSE 573
FOL Refutation Proof ( Friend(a,b) Friend(b,a) ) ( Friend(f(w),z) Drinks(z) ) Friend(x,f(x)) Drinks(G) Friend(f(x),x) Friend(f(w),G) () CSE 573
Next • Applications of Logic • Ontologies • Reasoning about Change • Planning CSE 573