170 likes | 300 Vues
This text provides an overview of First-Order Logic (FOL) and its utility in abstract reasoning and knowledge representation. It discusses the concepts of universal and existential quantifiers, instantiation methods, and how these principles lead to specific conclusions from general facts. The text also explores brute force reasoning, direct reasoning examples, and the importance of consistent substitutions in logical inference, including the unification algorithm. Understanding these concepts is crucial for effective knowledge base creation and deductive reasoning in artificial intelligence.
E N D
Inference in FOL Compared to predicate logic, more abstract reasoning and specific conclusions
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 before Skolem constant) p(k) D. Goforth, COSC 4117, fall 2006
Brute force reasoning • use instantiation to create a ‘propositional’ logic KB • complete BUT... • 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) • Substitute for instantiation: subst( {x/Socrates}, man(x) mortal(x)) man(Socrates) mortal(Socrates) • modus ponens mortal(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 example x 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 example x likes(Bill, x) y likes(y, Mary) => ~trusts(y,Father(Mary)) subst( {Bill/y, Mary/x}, likes(Bill, Mary)) makes two predicates identical likes(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 with subst ( {Bart/x, Art/z0} ) D. Goforth, COSC 4117, fall 2006
Unification algorithm Unify(L1, L2) // L1, L2 are both predicates or both objects • If (L1 or L2 is variable or constant) • if (L1==L2) return {} (no subst required) • if (L1 is variable) – if L1 in L2 return fail else return {L2/L1} • if (L2 is variable) – if L2 in L1 return fail else return {L1/L2} • return fail // both constants or functions // L1,L2 are predicates if we get to here • If predicate symbols of L1,L2 not identical, return fail • If L1,L2 have different number of arguments, return fail • Subst = {} • For (i = 1 to number of arguments in L1,L2) • S = Unify(L1.argument[i],L2.argument[i]) • if (S==fail) return fail • if (S!={}) apply S to remainder of L1,L2 Subst = Subst U S • Return Subst
Unification algorithm - examples Unify(L1, L2) // L1, L2 are predicates or objects • If (L1 or L2 is variable or constant) • if (L1==L2) Art, Art x,x • if (L1 is variable) – if L1 in L2 return fail else return {L2/L1} x, Father(x) x, Mother(y) • if (L2 is variable) – if L2 in L1 return fail else return {L1/L2}<similar> • return fail Art, Bart // L1,L2 are predicates if we get to here • If predicates of L1,L2 not identical Likes(x,y) Brother(z,w) • If L1,L2 have different # of arguments Band(x,y,z), Band(t,v) • Subst = {} • For (i = 1 to # of args in L1,L2) • S = Unify(L1.arg[i],L2.arg[i]) Likes(Bill,x) Likes(y,Father(y)) • if (S==fail) return fail • if (S!={}) apply S to remainder of L1,L2Likes(Bill,x) Likes(Bill,Father(Bill)) Subst = Subst U S • Return Subst
Inference: Reasoning methods • Forward chaining • Backward chaining • Resolution D. Goforth, COSC 4117, fall 2006
Resolution • convert sentences to equivalent conjunctive normal form (CNF) • apply resolution refutation D. Goforth, COSC 4117, fall 2006