270 likes | 604 Views
Inference in First Order Logic. CS 171/271 (Chapter 9) Some text and images in these slides were drawn from Russel & Norvig’s published material. Inference Algorithms. Reduction to Propositional Inference Lifting and Unification Chaining Resolution. Propositionalization.
E N D
Inference in First Order Logic CS 171/271 (Chapter 9) Some text and images in these slides were drawn fromRussel & Norvig’s published material
Inference Algorithms • Reduction to Propositional Inference • Lifting and Unification • Chaining • Resolution
Propositionalization • Strategy: convert KB to propositional logic and then use PL inference • Ground atomic sentences become propositional symbols • What about the quantifiers?
Example • KB in FOL: • x King(x) Greedy(x) Evil(x) • King(John) • Greedy(John) • Brother(Richard,John) • The last 3 sentences can be symbols in PL • Apply Universal Instantiation to the first sentence
Universal Instantiation • UI says that from a universally quantified sentence, we can infer any sentence obtained by substituting a ground term for the variable • Back to Example • From: x King(x) Greedy(x) Evil(x) • To: • King(John) Greedy(John) Evil(John) • King(Richard) Greedy(Richard) Evil(Richard) • …
Issue with UI • Ground terms: all symbols that refer to objects as well as function applications (recall that function applications return objects) • For example, suppose Father is a function: • Father(John) and Father(Richard) are also objects/ground terms • But so are Father(Father(John)) and Father(Father(Father(John))) • Infinitely many ground terms/instantiations
Existential Instantiation • Whenever there is a sentence, x P, introduce a new object symbol called the skolem constant and then add the unquantified sentence P, substituting the variable with that constant • Example: • From: x Crown(x) OnHead(x, John) • To: Crown(Cnew) OnHead(Cnew, John)
Substitution • UI and EI apply substitutions • A substitution is represented by a variable v and a ground term g; {v/g} • Can have sets of these pairs if there are more variables involved • Let be a sentence (possibly containing v) • SUBST( {v/g}, ) stands for the sentence that applies the substitution to
UI and EI Defined • UI:vα ___for any ground term gSUBST({v/g}, α) • EI:vα ___for some constant symbol k notSUBST({v/k}, α) yet in the knowledge base
Back to Propositionalization • Given a KB in FOL, convert KB to PL by • applying UI and EI to quantified sentences • converting atomic sentences to symbols • If there are no functions (Datalog KB), UI application does not result in infinitely many sentences • Regular PL Inference can now be carried out without problems • What if there are functions?
Dealing with Infinitely Many Ground Terms • Can set a depth-limit for ground terms • Depth specifies levels of function nesting allowed • Carry out reduction and inference process for depth 1, then 2, then 3, … • Stop when entailment can be concluded • This works if there is such a proof, but goes into an endless loop if there is not • The strategy is complete • The entailment problem in this sense is semidecidable
Inefficiencies in Propositionalization • An inordinate number of irrelevant sentences may be generated, resulting from UI • This motivates generating only those sentences that are important in entailment
Example • Suppose KB contains: • x King(x) Greedy(x) Evil(x) • y Greedy(y) • King(John) • Suppose we want to conclude Evil(John) • Because of the existence of objects other than John (such as Richard) and the existence of functions, UI will generate many sentences
Example, continued • It is sufficient to generate: • King(John) Greedy(John) Evil(John) • Greedy(John) • Which is just: • SUBST( {x/John}, King(x) Greedy(x) Evil(x) ) • SUBST( {y/John}, Greedy(y) ) • Applying the substitution matches the • Premises: King(x) Greedy(x) • With other sentences in the KB:Greedy(y), King(John)
Lifted Modus Ponens • Lifting: Raising propositional inference rules to first order logic • Example: Generalized Modus Ponens If there is a substitution θ, such thatSUBST(θ, pi) = SUBST(θ, pi’) for all i, then p1', p2', … , pn’, ( p1 p2 … pn q) _______________________________________________________________________________ SUBST(θ,q) • In our example, = {x/John, y/John}
Unification • Process that makes logical expressions identical • Goal: match the premises of implications so that conclusions can be derived • UNIFY algorithm takes two sentences and returns a unifier (substitution) if it exists
About UNIFY • UNIFY returns a Most General Unifier (MGU) • There are efficiency issues withOCCUR-CHECK function • May need to standardize apart: rename variables to avoid name clashes • Unification is a key component of all first-order algorithms
What’s Next? • Forward and backward chaining algorithms for FOL that use unification • Resolution-based theorem proving systems