Inference in First-Order Logic I
Inference in First-Order Logic I
Inference in First-Order Logic I
CIS 391 Introduction to Artificial Intelligence AIMA Chapter 9.1-9.2 (through p. 278) Chapter 9.5 (through p. 300)
Outline
Reducing first-order inference to propositional inference Unification Generalized Modus Ponens
Subst({v/g}, )
for any variable v and ground term g E.g., x King(x) Greedy(x) Evil(x) yields any or all of:
Subst({v/k}, )
E.g., x Crown(x) OnHead(x,John) yields:
Crown(C1) OnHead(C1,John) provided C1 is a new constant symbol, called a Skolem constant
The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.
Reduction contd.
Claim: 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 result Problem: with function symbols, there are infinitely many ground terms, e.g., Father(Father(Father(John)))
Reduction contd.
Theorem: Herbrand (1930). If a sentence is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to do create a propositional KB by instantiating with depth-n terms see if is entailed by this KB Problem: works if is entailed, loops if is not entailed Theorem: Turing (1936), Church (1936) Entailment for FOL is semidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.)
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
10
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
11
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
12
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
13
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
14
Unification
We can get the inference Evil(John) immediately if we can find a substitution such that King(x) and Greedy(x) match King(John) and Greedy(y)
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 }
16
17
18
GMP used with KB of definite clauses (exactly one positive literal) All variables assumed universally quantified
19
Soundness of GMP
Need to show that
p1', , pn', (p1 pn q) q
provided that pi' = pi for all i Lemma: For any definite clause p, we have p p by UI
1. (p1 pn q) (p1 pn q) = (p1 pn q) 2. p1', , pn' p1' pn' p1' pn' 3. From 1 and 2, q follows by ordinary Modus Ponens
20
For example,
with = {x/Ken}
Apply resolution steps to CNF(KB ); complete for FOL
CIS 391 - Intro to AI 21
2. Move inwards: x p x p, x p x p
x [y Animal(y) Loves(x,y)] [y Loves(y,x)] x [y Animal(y) Loves(x,y)] [y Loves(y,x)]
22
4.
5.
6.
23
24
26
Example proof:
Jack owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat? The axioms can be represented as follows: A. (x) Dog(x) ^ Owns(Jack,x) B. (x) ((y) Dog(y) ^ Owns(x, y)) => AnimalLover(x) C. (x) AnimalLover(x) => (y) Animal(y) => ~Kills(x,y) D. Kills(Jack,Tuna) Kills(Curiosity,Tuna) E. Cat(Tuna) F. (x) Cat(x) => Animal(x)
(This and next 2 slides adapted from CMSC421 Fall 2006, Univ. of Maryland)
27
28
29