6 Reduction contd.Every FOL KB can be propositionalized so as to preserve entailment(A ground sentence is entailed by new KB iff entailed by original KB)Idea: propositionalize KB and query, apply resolution, return resultProblem: with function symbols, there are infinitely many ground termse.g., Father(Father(Father(John)))

7 Reduction contd.Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KBIdea: For n = 0 to ∞ docreate a propositional KB by instantiating with depth-n termssee if α is entailed by this KBProblem: works if α is entailed, loops if α is not entailedsemidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.)

12 Unification To unify Knows(John,x) and Knows(y,z),θ = {y/John, x/z } or θ = {y/John, x/John, z/John}The first unifier is more general than the second.There is a single most general unifier (MGU) that is unique up to renaming of variables.MGU = { y/John, x/z }

14 The composition s1 and s2 is denoted by s1 s2, which is that substitution obtained by first applying s2 to the terms of s1 and then adding any pairs of s2 having variables not occurring among the variables of s1. Thus,

15 Unification Let w be P(x,y), s1 be {x/f(y)}, and s2 be {y/A} then,Substitutions are not, in general, commutativeUnifiable: a set of expressions is unifiable if there exists a substitution s such that, to yield

21 Example knowledge baseThe law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American.Prove that Col. West is a criminal

22 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations:American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x)Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(x):Owns(Nono,M1) and Missile(M1)… all of its missiles were sold to it by Colonel WestMissile(x)  Owns(Nono,x)  Sells(West,x,Nono)Missiles are weapons:Missile(x)  Weapon(x)An enemy of America counts as "hostile“:Enemy(x,America)  Hostile(x)West, who is American …American(West)The country Nono, an enemy of America …Enemy(Nono,America)

27 Properties of forward chainingSound and complete for first-order definite clausesDatalog = first-order definite clauses + no functionsFC terminates for Datalog in finite number of iterationsMay not terminate in general if α is not entailedThis is unavoidable: entailment with definite clauses is semidecidable

28 Efficiency of forward chainingMatching rules against Known factsWe can remind ourselves that most rules in real-world knowledge bases are small and simple, conjunct orderingWe can consider subclasses of rules for which matching is efficient, most constrained variableWe can work hard to eliminate redundant rule matching attempts in the forward chaining algorithm, which is the subject of the next sectionIncremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1match each rule whose premise contains a newly added positive literalMatching itself can be expensive:e.g., query Missile(x) retrieves Missile(M1)Forward chaining is widely used in deductive databases

39 Properties of backward chainingDepth-first recursive proof search: space is linear in size of proofIncomplete due to infinite loops fix by checking current goal against every goal on stackInefficient due to repeated subgoals (both success and failure) fix using caching of previous results (extra space)Widely used for logic programming

45 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations:American(x)  Weapon(y)  Sells(x,y,z)  Hostile(z)  Criminal(x)Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(x):Owns(Nono,M1) and Missile(M1)… all of its missiles were sold to it by Colonel WestMissile(x)  Owns(Nono,x)  Sells(West,x,Nono)Missiles are weapons:Missile(x)  Weapon(x)An enemy of America counts as "hostile“:Enemy(x,America)  Hostile(x)West, who is American …American(West)The country Nono, an enemy of America …Enemy(Nono,America)

47 Refinement StrategiesSet of support strategyAllows only those resolutions in which one of the clauses being resolved is in the set of support, i.e., those clauses that are either clauses coming from the negation of the theorem to be proved or descendants of those clauses.Refutation completeLinear input strategyat least one of the clauses being resolved is a member of the original set of clauses.Not refutation completeAncestry filtering strategyat least one member of the clauses being resolved either is a member of the original set of clauses or is an ancestor of the other clause being resolved.