Upload
clinton-miles
View
212
Download
0
Embed Size (px)
Citation preview
Inference in FOL
Compared to predicate logic,more abstract reasoning and specific conclusions
D. Goforth, COSC 4117, fall 2006
FOL knowledge bases
Facts about environment involve statements about specific objects E.g., Dentist(Bill), Likes(Mary, Candy)
General knowledge is mainly statements about sets of objects involving quantifiers E.g., x Dentist(x) ⇒ Likes(x, Candy)
D. Goforth, COSC 4117, fall 2006
Deductive reasoningfrom general to specific
how do quantified sentences get applied to facts? universal quantifier existential quantifier
instantiation: substituting a reference to an object for a variable
inference: conclusions entailed in KB
D. Goforth, COSC 4117, fall 2006
Instantiating Universal quantifier (UI)
x p(x) statement is always true any substitution makes a legitimate
statement format:
x p(x)subst( {x/k}, p(x) )
(K is any constant or function from KB)p(K)
D. Goforth, COSC 4117, fall 2006
Instantiating Existential quantifier (UI) x p(x) statement is true for some object name the object for which it is true format:
x p(x)subst( {x/k}, p(x) )
(k is a new constant, never used beforeSkolem constant)
p(k)
D. Goforth, COSC 4117, fall 2006
Brute force reasoning
use instantiation to create a ‘propositional’ logic KB
completeBUT... presence of functions causes infinitely
large set of sentences (Father(Al), Father(Father(Al))
semi-decidable (disproofs never end)
D. Goforth, COSC 4117, fall 2006
Direct reasoning
x man(x) mortal(x) man(Socrates)1. Substitute for instantiation:subst( {x/Socrates}, man(x) mortal(x))man(Socrates) mortal(Socrates)2. modus ponensmortal(Socrates)
D. Goforth, COSC 4117, fall 2006
Substitutions for reasoning
generalized modus ponens
p1, p2, p3, (p1 ^ p2 ^ p3 )=> q
subst( {x1/k1, x2/k2..}, q)
Unification: substitutions so that the sentences are consistently instantiated
D. Goforth, COSC 4117, fall 2006
Substitutions for reasoning generalized modus ponens example
Parent(Art,Barb),
Parent(Barb,Carl),
(Parent(x,y) ^ Parent(y,z ) ⇒ Grandparent(x,z)
subst( {x/Art, y/Barb,z/Carl}, q)
(Parent(Art,Barb) ^ Parent(Barb,Carl )⇒ Grandparent(Art,Carl)
Grandparent(Art,Carl)
D. Goforth, COSC 4117, fall 2006
Consistent substitutions
unification algorithm – p.278 or variant here
examplex likes(Bill, x) (Bill likes everyone)y likes(y, Mary) (everyone likes Mary)subst( {Bill/y, Mary/x}, likes(Bill, Mary)) makes two predicates identical
D. Goforth, COSC 4117, fall 2006
Application
examplex likes(Bill, x)y likes(y, Mary) => ~trusts(y,Father(Mary))
subst( {Bill/y, Mary/x}, likes(Bill, Mary)) makes two predicates identicallikes(Bill, Mary),likes(Bill, Mary) => ~trusts(Bill,Father(Mary)) ~trusts(Bill,Father(Mary))
D. Goforth, COSC 4117, fall 2006
Examples
unify: Likes(x,Art), Likes(Father(y), y)
{Art/y} Likes(x,Art), Likes(Father(Art), Art)
{Art/y, Father(Art)/x}
unify: Likes(x,Art), Likes(Bart, x)
fails, can’t subst x for Art and Bart
D. Goforth, COSC 4117, fall 2006
Examples unify:
Likes(x,Art), Likes(Bart, x) fails, can’t subst x for Art and Bart
BUT where did ‘x’ come from? Art likes everybody: x Likes(x, Art) Everybody likes Bart: x Likes(Bart, x)standardize apart: z0 Likes(Bart, z0)
then Likes(Bart, Art) is OK withsubst ( {Bart/x, Art/z0} )
Unify(L1, L2) // L1, L2 are both predicates or both objects
1. If (L1 or L2 is variable or constant)i. if (L1==L2) return {} (no subst required)
ii. if (L1 is variable) – if L1 in L2 return fail else return {L2/L1}
iii. if (L2 is variable) – if L2 in L1 return fail else return {L1/L2}iv. return fail // both constants or functions
// L1,L2 are predicates if we get to here
2. If predicate symbols of L1,L2 not identical, return fail
3. If L1,L2 have different number of arguments, return fail4. Subst = {}5. For (i = 1 to number of arguments in L1,L2)
i. S = Unify(L1.argument[i],L2.argument[i])ii. if (S==fail) return failiii. if (S!={})
apply S to remainder of L1,L2
Subst = Subst U S
6. Return Subst
Unification algorithm
Unify(L1, L2) // L1, L2 are predicates or objects1. If (L1 or L2 is variable or constant)
i. if (L1==L2) Art, Art x,x
ii. if (L1 is variable) – if L1 in L2 return fail else return {L2/L1}x, Father(x) x, Mother(y)
i. if (L2 is variable) – if L2 in L1 return fail else return {L1/L2} <similar>ii. return fail Art, Bart
// L1,L2 are predicates if we get to here
2. If predicates of L1,L2 not identical Likes(x,y) Brother(z,w)
3. If L1,L2 have different # of arguments Band(x,y,z), Band(t,v)4. Subst = {}5. For (i = 1 to # of args in L1,L2)
i. S = Unify(L1.arg[i],L2.arg[i]) Likes(Bill,x) Likes(y,Father(y)) ii. if (S==fail) return failiii. if (S!={})
apply S to remainder of L1,L2 Likes(Bill,x) Likes(Bill,Father(Bill)) Subst = Subst U S
6. Return Subst
Unification algorithm - examples
D. Goforth, COSC 4117, fall 2006
Inference: Reasoning methods
Forward chaining Backward chaining Resolution
D. Goforth, COSC 4117, fall 2006
Resolution
1. convert sentences to equivalent conjunctive normal form (CNF)
2. apply resolution refutation