SlideShare a Scribd company logo
Logical Representations and
Resolution
Boolean Logic
•Conjunctive normal form
•Resolution
Conjunctive Normal Form
A literal is a variable or a negated variable.
A clause is either a single literal or the disjunction of two or
more literals.
P, P  P, and P  Q  R  S are clauses.
(R  S ) and P  Q are not clauses.
A wff is in conjunctive normal form iff it is either a single
clause or the conjunction of two or more clauses.
(P  Q  R  S)  (P  R) is in cnf
(P  Q  R  S)  (P  R) is not in cnf
Conjunctive Normal Form Theorem
Theorem: Every wff can be converted to an equivalent wff in
conjunctive normal form.
Proof: By construction: conjunctiveBoolean(w: wff) =
1. Eliminate  and  from w, using the fact that P  Q is
equivalent to P  Q.
2. Reduce the scope of each  to a single term, using the facts:
• Double negation: (P) = P
• deMorgan’s laws:
• (P  Q)  (P  Q)
• (P  Q)  (P  Q)
3. Convert w to a conjunction of clauses using the fact that
both  and  are associative and the fact that  and 
distribute over each other.
Conversion to Conjunctive Normal Form
Let w be the wff :
P  (R  Q).
Then w can be converted to conjunctive normal form as
follows:
Step 1 produces: P  (R  Q).
Step 2 produces: P  (R  Q).
Step 3 produces: (P  R)  (P  Q).
Resolution
Suppose we know:
winter  summer
winter
summer
summer
nil
winter  summer
winter  cold
summer  cold
Resolution
From the premises: (P  Q) and (R  Q),
Conclude: (P  R).
Resolution is sound: If (P  Q) and (R  Q) are True, then:
• If Q is True, R must be True.
• If Q True, P must be True.
Since either Q or Q must be True, P  R must be True.
Resolution – The Algorithm
To prove ST from A:
1. Convert A to a list L of clauses in conjunctive normal
form.
2. Construct ST and add it to L.
3. Resolve.
Complementary Literals
A pair of complementary literals is a pair of literals that are not
mutually satisfiable. So two literals are complementary iff
one is positive, one is negative, and they contain the same
propositional symbol. For example, Q and  Q.
Choose two parent clauses that contain a pair of complementary
literals. For example:
C1 = R1  R2  …  Rj  Q
C2 = S1  S2  …  Sk  Q.
Resolve C1 and C2 to derive:
R1  R2  …  Rj  S1  S2  …  Sk
Resolution – Generating nil
Consider:
Q Q
nil
The empty clause is unsatisfiable since it contains no literals
that can be made True. So if it is ever generated, the
resolution procedure halts and reports that, since adding
ST to A has led to a contradiction, ST is a theorem given
A.
Resolution – The Algorithm
resolve-Boolean(A, ST) =
1. Construct L, the list of of clauses from A.
2. Negate ST, convert the result to conjunctive normal form,
and add the resulting clauses to L.
3. Until either nil is generated or no progress is being made
do:
3. 1 Choose two parent clauses.
3. 2 Resolve the parent clauses together.
3. 3 If the resolvent is not nil and is not in L, add
it to L.
4. If nil was generated, a contradiction has been found. Return
success. ST must be true.
5. If nil was not generated and there was nothing left to do,
return failure.
Resolution – An Example
Prove R given:
Given Axioms: Clauses:
P P
(P  Q)  R P  Q  R
(S  T)  Q S  Q
T  Q
T T
Add:
 R  R
Resolution – An Example
P
P  Q  R
S  Q
T  Q
T
 R
P  Q  R  R
P  Q P
T  Q Q
T T
nil
Resolution – Only Select One Pair to Resolve
P  Q (1)
P  Q  R (2)
Prove R:
P  Q  R R
P  Q P  Q
? nil
But is R entailed by the two facts we have been given?
Facts in English
(1) Marcus was a man.
(2) Marcus was a Pompeian.
(3) All Pompeians were Romans.
(4) Caesar was a ruler.
(5) All Romans were either loyal to Caesar or hated him.
(6) Everyone is loyal to someone.
(7) People only try to assassinate rulers they are not loyal to.
(8) Marcus tried to assassinate Caesar.
An Example - Facts in FOL
(1) Marcus was a man.
man(Marcus)
(2) Marcus was a Pompeian.
Pompeian(Marcus)
(3) All Pompeians were Romans.
x Pompeian(x)  Roman(x)
(4) Caesar was a ruler.
ruler(Caesar)
(5) All Romans were either loyal to Caesar or hated him.
x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar)
(6) Everyone is loyal to someone.
x y loyalto(x, y)
(7) People only try to assassinate rulers they are not loyal to.
x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y)
(8) Marcus tried to assassinate Caesar.
tryassassinate(Marcus, Caesar)
Question Answering
(1) Marcus was a man.
man(Marcus)
(2) Marcus was a Pompeian.
Pompeian(Marcus)
(3) All Pompeians were Romans.
x Pompeian(x)  Roman(x)
(4) Caesar was a ruler.
ruler(Caesar)
(5) All Romans were either loyal to Caesar or hated him.
x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar)
(6) Everyone is loyal to someone.
x y loyalto(x, y)
(7) People only try to assassinate rulers they are not loyal to.
x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y)
(8) Marcus tried to assassinate Caesar.
tryassassinate(Marcus, Caesar)
Was Marcus loyal to Caesar?
Reasoning Backward
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) x Pompeian(x)  Roman(x)
(4) ruler(Caesar)
(5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar)
(6) x y loyalto(x, y)
(7) x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y)
(8) tryassassinate(Marcus, Caesar)
loyalto(Marcus, Caesar)
(Marcus/x) (Caesar/y)
person(Marcus) ruler(Caesar) tryassassinate(Marcus, Caesar)
Reasoning Backward
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) x Pompeian(x)  Roman(x)
(4) ruler(Caesar)
(5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar)
(6) x y loyalto(x, y)
(7) x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y)
(8) tryassassinate(Marcus, Caesar)
(9) x man(x)  person(x)
loyalto(Marcus, Caesar)
(Marcus/x) (Caesar/y)
person(Marcus) ruler(Caesar) tryassassinate(Marcus, Caesar)
(Marcus/x)
man(Marcus)
Functions and Predicates
(1) Marcus was a man.
man(Marcus)
(2) Marcus was a Pompeian.
Pompeian(Marcus)
(3) Marcus was born in 40 A.D.
born(Marcus, 40)
(4) All men are mortal.
x man(x)  mortal(x)
(5, 6) AllPompeians died when the volcano erupted in 79 A.D.
erupted(volcano, 79)  x Pompeian(x)  died(x,79)
(7) No mortal lives longer than 150 years.
x t1 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2)
(8) It is now 2004.
now = 2004
Is Marcus alive?
Functions and Predicates
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) born(Marcus, 40)
(4) x man(x)  mortal(x)
(5) erupted(volcano, 79)
(6) x Pompeian(x)  died(x,79)
(7) x t1 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2)
(8) now = 2007
 alive(Marcus, now)
Functions and Predicates - Filling in the Blanks
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) born(Marcus, 40)
(4) x man(x)  mortal(x)
(5) erupted(volcano, 79)
(6) x Pompeian(x)  died(x,79)
(7) x t2 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2)
(8) now = 2007
(9a) x t alive(x, t)  dead(x, t)
(9b) x t dead(x,t)  alive(x, t)
(10) x t2 t2 died(x, t1)  gt(t2, t1)  dead(x, t2)
 alive(Marcus, now)
Showing that Marcus is Not Alive
 alive(Marcus, now)
(9a) (Marcus/x) (now/t)
dead(Marcus, now)
(10)(Marcus/x)(now/t2) (7) (Marcus/x)(now/t2)
died(Marcus, t1) gt(now, t1) mortal(Marcus) born(Marcus, t1) gt(now-t1,150)
(5) (Marcus/x) (4) (Marcus/x) (3) (40/t1) subst
(79/t1)
Pompeian(Marcus) gt(now, 79) man(Marcus) born(Marcus, 40) gt(now-40,150)
(2) subst (1) subst
T gt(2004, 79) T T gt(2007-40,150)
eval eval
T T
A Harder One
Given:
x [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
Roman(Isaac)
hate(Isaac, Caesar)
hate(Paulus, Marcus)
thinkcrazy(Isaac, Paulus)
Prove:
know(Isaac, Marcus)
Prenex Normal Form
A sentence in first-order logic is in prenex normal form iff it is
of the form:
<quantifier list> <matrix>,
where <quantifier list> is a list of quantified variables and
<matrix> is quantifier-free.
x (y ((P(x)  Q(y))  z (R(x, y, z))) is not
in pnf.
x y z (P(x)  Q(y))  R(x, y, z) is in pnf. Its matrix is:
(P(x)  Q(y))  R(x, y, z).
Clause Form
A sentence is in clause form iff:
• It has been converted to prenex normal form,
• Its quantifier list contains only universal quantifiers,
• Its quantifier list is no longer explicitly represented,
• It is in conjunctive normal form, and
• There are no variable names that appear in more than one
clause.
Begin with: x (P(x)  Q(x))  y (S(y))
In prenex normal form: x y (P(x)  Q(x))  S(y)
In clause form: (P(x)  Q(x))  S(y)
Clause Form Simplifies the Process
x [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
becomes:
Roman(x)  know(x, Marcus)  hate(x, Caesar)  hate(y, z)
 thinkcrazy(x, y)
Conversion to Clause Form - Step 1
1. Eliminate , using the fact that a  b is equivalent to
a  b
x [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
x  [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
Conversion to Clause Form - Step 2
2. Reduce the scope of each  to a single term, using:
•(p) = p
•deMorgan’s laws
•x P(x)  x P(x)
•x P(x)  x P(x)
x  [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
x [ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  (y z  hate(y, z)  thinkcrazy(x, y))]
Conversion to Clause Form - Step 3
3. Standardize variables so that each quantifier binds a unique
variable.
x P(x)  x Q(x)
x P(x)  y Q(y)
Conversion to Clause Form - Step 4
4. Move all quantifiers to the left without changing their relative
order.
x [ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  (y z  hate(y, z)  thinkcrazy(x, y))]
x y z [ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]
At this point, we have prenex normal form.
Conversion to Clause Form - Step 5
5. Eliminate existential quantifiers through the use of Skolem
functions and constants.
x Roman(x) Roman(S1)
x z father-of(x, z) x father-of(x, S2(x))
Conversion to Clause Form - Step 6
6. Drop the prefix since all remaining quantifiers are universal.
x y z [ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]
[ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]
Conversion to Clause Form - Step 7
7. Convert the matrix into a conjunction of disjuncts by using:
•Associative properties of  and .
[ Roman(x)   know(x, Marcus)] 
[hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]
 Roman(x)   know(x, Marcus) 
hate(x, Caesar)   hate(y, z)  thinkcrazy(x, y)
•Distributivity of  and .
(P(x)  Q(x))  T(x)
(P(x)  T(x))  (Q(x))  T(x))
Conversion to Clause Form - Step 8
8. Create a separate clause for each conjunct.
(P(x)  T(x))  (Q(x))  T(x))
(P(x)  T(x))
(Q(x))  T(x))
Conversion to Clause Form - Step 9
9. Standardize apart the variables.
(P(x)  T(x))
(Q(x))  T(x))
(P(x)  T(x))
(Q(y))  T(y))
Resolution in FOL
To find a contradiction, we must show that the KB, augmented with
P, is unsatisfiable.
Herbrand’s theorem tells us:
1. To show that a set of clauses S is unsatisfiable, it is necessary to
consider only interpretations over a particular set called the
Herbrand universe of S, which is the set of all ground terms
constructable from the following:
1. The function symbols in S, if any.
2. The constant symbols in S, if any. If none, then the constant
symbol A.
2. A set of clauses S is unsatisfiable iff a finite subset of ground
instances (in which all bound variables have had a value
substituted for them) of S is unsatisfiable.
Resolution is an algorithm that finds contradictions without
enumerating most of the Herbrand universe.
Unification
In propositional logic, it is easy to identify complementary
literals such as P and P.
But in FOL, what should we do about:
x,y (hate(x, y))
hate(Marcus, Caesar)
Or: hate(Marcus, Caesar)
hate(Paulus, Caesar)
Or: x,y (P(x, x))
P(Marcus, Caesar)
Before We Start
Before we consider a set of formulas and begin to reason with
them, we need to standardize the variables apart:
Consider:
x, y Lived-In(x, y)
x, y Mother-Of(x, y)
Although we have used x and y in both of these formulas, the
variables in these formulas are logically distinct since they occur
inside the scope of quantifiers that are independent (i.e., neither
lies inside the scope of the other). So an equivalent way to write
these facts is:
x1, y1 Lived-In(x1, y1)
x2, y2 Mother-Of(x2, y2)
Unification
We need an algorithm that does two things given a sentence S and
a term T:
•Determine whether T matches some term T´ in S, and
•Return a substitution that can be applied to the remainder of S.
Example:
S: x,y In(x, y)  Climate(y, moderate)  Climate(x, moderate)
T: In(Italy, Europe)
The process we will call unification will determine that T matches
the first term of S and it will return the substitution Italy/x,
Europe/y. When we apply that to the remainder of S, we have:
Climate(Europe, moderate)  Climate(Italy, moderate)
The Unification Algorithm
unify-for-resolution(lit1, lit2) =
If either lit1 or lit2 is a variable or a constant then:
Case (checking the conditions in order and executing only the first one that
matches):
lit1 and lit2 are identical: return nil. /* Succeed with no substitution.
lit1 is a variable that occurs in lit2: return Fail. /* These two cases implement the
lit2 is a variable that occurs in lit1: return Fail. occur check.
lit1 is a variable: return (lit2/lit1).
lit2 is a variable: return (lit1/lit2).
otherwise: return Fail. /* No match.
If the initial predicate or function symbols of lit1 and lit2 are not the same, return Fail.
If lit1 and lit2 do not have the same number of arguments, return Fail.
substitution-list = nil.
For i = 1 to the number of arguments of lit1 do
Let S be the result of unify-for-resolution on the ith argument of lit1 and of lit2.
If S contains Fail, return Fail.
If S is not equal to nil then:
Apply S to the remainder of both lit1 and lit2.
Append S to substitution-list.
Return substitution-list.
The Occur Check
Suppose we are trying to unify: P(x, x)
P(g(x), g(x))
What happens if we skip the occur check?
x and g(x) unify and yield the substitution g(x)/x.
Now we must apply that substitution :
g(x) g(g(x)) 
g(g(x)) g(g(g(x)))
But if we’d standardized apart the variables before we started,
this wouldn’t have been a problem.
The Occur Check is Necessary Even with
Standardizing Apart
Suppose we are trying to unify: P(x, f(x), x)
P(f(a), a, a)
x and f(a) unify and yield the substitution f(a)/x. Applying it:
f(f(a)), f(a)
a, a
Without the occur check, f(f(a)) and a will unify, yielding the
substitution f(f(a))/a. To apply it, we must replace all a’s in the
remaining terms. But that process never terminates.
Most General Unifiers (MGUs)
Suppose we are trying to prove x,y (A(x, y)  B(x, y))
Using the fact z (A(John, z))
Unifying A(x, y) with A(John, z) yields John/x, z/y. Applying it:
z (B(John, z))
But we could also have matched with the substitution John/x,
John/y, and been left trying to prove B(John, John), which
would be harder.
The algorithm we have presented always returns the most
general unifier. The MGU is unique up to variable name
substitution.
Unification Examples
Inputs
[1] Roman(x),
Roman(Paulus)
[2] Roman(x),
Ancient(Paulus)
[3] Roman(father-of(Marcus)),
Roman(x)
[4] Roman(father-of(Marcus)),
Roman(Flavius),
[5] Roman(x),
Roman(y),
[6] Roman(father-of(x)),
Roman(x)
[7] Likes(x, y),
Likes(Flavius, Marcus)
Result
Succeed
Fail
Succeed
Fail
Succeed
Fail (fails occur
check)
Succeed
Substitution
Paulus/x
father-of(Marcus)/x
x/y
Flavius/x, Marcus/y
FOL Resolution – An Example
Prove: Mortal(Marcus) given:
x (Man(x)  Mortal(x)) Man(x)  Mortal(x)
Man(Marcus) Man(Marcus)
Add: Mortal(Marcus)
Man(x)  Mortal(x) Mortal(Marcus)
Marcus/x
Man(Marcus)  Man(Marcus)
nil
FOL Resolution – the Algorithm
resolve-FOL(A, ST) =
Construct L, the list of clauses from A.
Rename all variables in ST so that they do not conflict with any variables in L.
Negate ST, convert the result to clause form, and add the resulting clauses to L.
Until either nil is generated or no progress is being made do:
Choose from L two (parent) clauses that contain a pair CL of complementary
literals.
Resolve the parent clauses together to produce a resolvent:
Initially, let the resolvent be the disjunction of all of the literals in both parent
clauses
except for the two literals in CL.
Apply to all of the literals in the resolvent the substitution that was
constructed when
the literals in CL were unified.
Rename all of the variables in the resolvent so that they do not conflict with
any of the
variables in L.
If the resolvent is not nil and is not already in L, add it to L.
If nil was generated, a contradiction has been found. Return success. ST must be true.
If nil was not generated and there was nothing left to do, return failure. ST may or may
not be true. But no proof of ST has been found.
Heuristics to Aid the Resolution Procedure
•Only resolve pairs of clauses that contain complementary
literals.
P(x) Q(x)
•Eliminate certain clauses as soon as they are generated:
•Tautologies
•Clauses that are subsumed by other clauses.
•Set of support strategy: whenever possible resolve with a
clause that is part of the statement we are trying to prove.
•Unit preference strategy: whenever possible, resolve with
clauses that have a single literal.
Subsumption
Clause A subsumes clause B iff B must be true in any
interpretation in which A is true. (A is more general than B.)
True
P  Q  R  T W
P  Q R  T
P Q
P  Q
P  Q  W
Subsumption in FOL
Clause A subsumes clause B iff B must be true in any
interpretation in which A is true. (A is more general than B.)
True
x (P(x))
P(Marcus)
x(P(x))
Using Resolution
Painter(Leonardo)
Composer(Palistrina)
Country(Italy)
Lived-In(Leonardo, Italy)
In(Italy,Europe)
Climate(Europe, moderate)
Painter(Rubens)
Lived-In(Rubens, Europe)
x,y (In(x, y)  Climate(y, moderate)  Climate(x, moderate))
Prove that Leonardo was a painter who lived in a moderate climate.
Prove: y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate))
Negate it: (y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate)))
Converting to Clause From
Painter(Leonardo)
Composer(Palistrina)
Country(Italy)
Lived-In(Leonardo, Italy)
In(Italy,Europe)
Climate(Europe, moderate)
Painter(Rubens)
Lived-In(Rubens, Europe)
x,y (In(x, y)  Climate(y, moderate)  Climate(x, moderate))
 In(x, y)   Climate(y, moderate)  Climate(x, moderate)
(y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate)))
y ((Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate)))
Painter(Leonardo)   Lived-In(Leonardo,y)   Climate(y, moderate)
Using Resolution
1. Painter(Leonardo) 2. Composer(Palistrina)
3. Country(Italy) 4. Lived-In(Leonardo, Italy)
5. In(Italy,Europe) 6. Climate(Europe, moderate)
7. Painter(Rubens) 8. Lived-In(Rubens, Europe)
9. Painter(Sargent)
10.  In(x, y)   Climate(y, moderate)  Climate(x, moderate)
Painter(Leonardo)  Lived-In(Leonardo,y) Climate(y, moderate) Painter(Leonardo)
Leonardo/x
Lived-In(Leonardo, Italy)  Lived-In(Leonardo,y1)   Climate(y1, moderate)
Italy/y1
 Climate(Italy, moderate)
Using Resolution
1. Painter(Leonardo) 2. Composer(Palistrina)
3. Country(Italy) 4. Lived-In(Leonardo, Italy)
5. In(Italy,Europe) 6. Climate(Europe, moderate)
7. Painter(Rubens) 8. Lived-In(Rubens, Europe)
9. Painter(Sargent)
10.  In(x, y)   Climate(y, moderate)  Climate(x, moderate)
Painter(Leonardo)   Lived-In(Leonardo,y)   Climate(y, moderate) Painter(Leonardo)
Leonardo/x
Lived-In(Leonardo, Italy)  Lived-In(Leonardo,y1)   Climate(y1, moderate)
Italy/y1
 In(x, y)   Climate(y, moderate)Climate(x, moderate)  Climate(Italy, moderate)
Italy/x
In(Italy,Europe)  In(Italy, y2)   Climate(y2, moderate)
Europe/y2
Climate(Europe, moderate)  Climate(Europe, moderate)
nil
Answering Questions
A Question: Name a painter who lived in a moderate climate.
?Painter(x)  Lived-In(x,y)  Climate(y, moderate)
Construct an existence statement to be proved:
x, y (Painter(x)  Lived-In(x,y)  Climate(y, moderate))
Negate it and resolve, tracking the bindings:
 (x, y (Painter(x)  Lived-In(x,y)  Climate(y, moderate)))
x,y ((Painter(x)  Lived-In(x,y)  Climate(y, moderate)))
Painter(x)   Lived-In(x,y)   Climate(y, moderate)
Tracking the Bindings
Painter(x)  Painter(x)   Lived-In(x,y)   Climate(y, moderate) Painter(Leonardo)
Leonardo/x
Painter(Leonardo)   Lived-In(Leonardo,y1)   Climate(y1, moderate)
Lived-In(Leonardo, Italy)
Italy/y1
Painter(Leonardo)   Climate(Italy, moderate)
 In(x, y)   Climate(y, moderate)Climate(x, moderate)
Italy/x
In(Italy,Europe) Painter(Leonardo)   In(Italy, y2)   Climate(y2, moderate)
Europe/y2
Climate(Europe, moderate) Painter(Leonardo)   Climate(Europe, moderate)
Painter(Leonardo)
A Reminder About Standardizing Variables Apart
Prove father(Chris, Bill) given:
father(x, y)  woman(x) (1)
{father(x, y) woman(x)}
mother(x, y)  woman(x) (2)
{mother(x, y)  woman(x)}
mother(Chris, Mary) (3)
Add: father(Chris, Bill)
father(x, y)  woman(x) mother(x, y)  woman(x)
* father(x, y)  mother(x, y) mother(Chris, Mary)
Chris/x, Mary/y
father(Chris, Mary)
Back to Marcus
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) x Pompeian(x)  Roman(x)
(4) ruler(Caesar)
(5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar)
(6) x y loyalto(x, y)
(7) x y man(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y)
(8) tryassassinate(Marcus, Caesar)
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) Pompeian(x1)  Roman(x1)
(4) ruler(Caesar)
(5) Roman(x2)  loyalto(x2, Caesar)  hate(x2, Caesar)
(6) loyalto(x3, S1(x3))
(7) man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1)
(8) tryassassinate(Marcus, Caesar)
Proving Marcus Not Loyal to Caesar
loyalto(M, C)  man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1)
(M/x4)(C/y1)
 man(M)  ruler(C)  tryassassinate(M,C) man(M)
ruler(C)  tryassassinate(M,C) ruler(C)
tryassassinate(M,C) tryassassinate(M,C)
nil
Does Isaac Know Marcus?
Given:
1. x [Roman(x)  know(x, Marcus)] 
[hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
Roman(x)   know(x, Marcus)  hate(x, Caesar) 
 hate(y, z)  thinkcrazy(x, y)
2. Roman(Isaac)
3. hate(Isaac, Caesar)
4. hate(Paulus, Marcus)
5. thinkcrazy(Isaac, Paulus)
Prove:
know(Isaac, Marcus) * know(Isaac, Marcus)
Does Marcus Hate Caesar?
Try to prove hate(M, C):
Hate(M, C)
Try to Prove that Marcus Does Not Hate Caesar
Try to prove hate(M, C):
Hate(M, C)
Try (Again) to Prove that Marcus Does Not Hate
Caesar
Now try to prove hate(M, C):
Hate(M, C)
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) Pompeian(x1)  Roman(x1)
(4) ruler(Caesar)
(5) Roman(x2)  loyalto(x2, Caesar)  hate(x2, Caesar)
(6) loyalto(x3, S1(x3))
(7) man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1)
(8) tryassassinate(Marcus, Caesar)
(9) persecute(x5, y2)  hate(y2, x5) persecute(x, y)  hate(y, x)
(10) hate(x6, y3)  persecute(y3, x6) hate(x, y)  persecute(y, x)
A Winnie Example
"And if anyone knows anything about anything," said Bear to
himself,
"It's Owl who knows something about something," he said,
"Or my name
is not Winnie-the-Pooh," he said. "Which it is," he added.
"So there you are."
When Does Resolution Work?
Resolution is sound and refutation-complete.
If there is a contradiction, resolution will eventually find it if
resolvents are chosen systematically.
But:
•It may take exponential time.
•Satisfiability is semi-decidable: if a set of clauses is satisfiable,
resolution will never find a conflict and it may not notice that it
is failing to do so.
Satisfiability is Semi Decidable
Suppose we want to know whether P(x) is true. There are
three possibilities:
(1) P(x) is entailed by KB and thus:
P(x)  KB is unsatisfiable.
(2) P(x) is entailed by KB and thus:
P(x)  KB is unsatisfiable.
(3)
Horn Clauses
A Horn Clause is a clause in which at most one literal is
positive.
A(x)  B(x)  C(x) becomes
A(x)   B(x)  C(x) a Horn clause
Deciding entailment with Horn clauses can be done in time
that is linear in the size of the KB by using either backward or
forward chaining.

More Related Content

Similar to Ch8-LogicalRepresentationAndReasoning.ppt

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
leanCoR: lean Connection-based DL Reasoner
leanCoR: lean Connection-based DL ReasonerleanCoR: lean Connection-based DL Reasoner
leanCoR: lean Connection-based DL Reasoner
Adriano Melo
 
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
Unit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VECUnit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VEC
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
sundarKanagaraj1
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
IT Engineering Department
 
Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdf
smarwaneid
 
CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2David Wood
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
parmeet834
 
Abstract machines for great good
Abstract machines for great goodAbstract machines for great good
Abstract machines for great good
Александр Ежов
 
Otter 2014-12-22-01-slideshare
Otter 2014-12-22-01-slideshareOtter 2014-12-22-01-slideshare
Otter 2014-12-22-01-slideshareRuo Ando
 
X02PredCalculus.ppt
X02PredCalculus.pptX02PredCalculus.ppt
X02PredCalculus.ppt
MalligaarjunanN
 
1. Logic and Proofs.ppt
1. Logic and Proofs.ppt1. Logic and Proofs.ppt
1. Logic and Proofs.ppt
ThnhNguynQuang14
 
The Chase in Database Theory
The Chase in Database TheoryThe Chase in Database Theory
The Chase in Database Theory
Jan Hidders
 
9.class-notesr9.ppt
9.class-notesr9.ppt9.class-notesr9.ppt
9.class-notesr9.ppt
Pabitha Chidambaram
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docx
edwin orege
 
Logic and proof
Logic and proofLogic and proof
Logic and proof
Suresh Ram
 
Metodo Monte Carlo -Wang Landau
Metodo Monte Carlo -Wang LandauMetodo Monte Carlo -Wang Landau
Metodo Monte Carlo -Wang Landau
angely alcendra
 

Similar to Ch8-LogicalRepresentationAndReasoning.ppt (20)

Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
leanCoR: lean Connection-based DL Reasoner
leanCoR: lean Connection-based DL ReasonerleanCoR: lean Connection-based DL Reasoner
leanCoR: lean Connection-based DL Reasoner
 
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
Unit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VECUnit III  Knowledge Representation in AI   K.Sundar,AP/CSE,VEC
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
 
L08a
L08aL08a
L08a
 
Discrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order LogicDiscrete Math Lecture 02: First Order Logic
Discrete Math Lecture 02: First Order Logic
 
Chapter 01 - p2.pdf
Chapter 01 - p2.pdfChapter 01 - p2.pdf
Chapter 01 - p2.pdf
 
CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2CPSC 125 Ch 1 sec 2
CPSC 125 Ch 1 sec 2
 
LPS talk notes
LPS talk notesLPS talk notes
LPS talk notes
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Abstract machines for great good
Abstract machines for great goodAbstract machines for great good
Abstract machines for great good
 
Otter 2014-12-22-01-slideshare
Otter 2014-12-22-01-slideshareOtter 2014-12-22-01-slideshare
Otter 2014-12-22-01-slideshare
 
X02PredCalculus.ppt
X02PredCalculus.pptX02PredCalculus.ppt
X02PredCalculus.ppt
 
1. Logic and Proofs.ppt
1. Logic and Proofs.ppt1. Logic and Proofs.ppt
1. Logic and Proofs.ppt
 
The Chase in Database Theory
The Chase in Database TheoryThe Chase in Database Theory
The Chase in Database Theory
 
9.class-notesr9.ppt
9.class-notesr9.ppt9.class-notesr9.ppt
9.class-notesr9.ppt
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docx
 
FUZZY LOGIC
FUZZY LOGICFUZZY LOGIC
FUZZY LOGIC
 
Logic and proof
Logic and proofLogic and proof
Logic and proof
 
3 fol examples v2
3 fol examples v23 fol examples v2
3 fol examples v2
 
Metodo Monte Carlo -Wang Landau
Metodo Monte Carlo -Wang LandauMetodo Monte Carlo -Wang Landau
Metodo Monte Carlo -Wang Landau
 

More from FELICIALILIANJ

Artificial Intelligence and its application
Artificial Intelligence and its applicationArtificial Intelligence and its application
Artificial Intelligence and its application
FELICIALILIANJ
 
EIK - CO4.pptx
EIK - CO4.pptxEIK - CO4.pptx
EIK - CO4.pptx
FELICIALILIANJ
 
Innovation and Entrepreneurship- Introduction.ppt
Innovation and Entrepreneurship- Introduction.pptInnovation and Entrepreneurship- Introduction.ppt
Innovation and Entrepreneurship- Introduction.ppt
FELICIALILIANJ
 
upload3.pptx
upload3.pptxupload3.pptx
upload3.pptx
FELICIALILIANJ
 
uploadscribd2.pptx
uploadscribd2.pptxuploadscribd2.pptx
uploadscribd2.pptx
FELICIALILIANJ
 
uploadscribd.pptx
uploadscribd.pptxuploadscribd.pptx
uploadscribd.pptx
FELICIALILIANJ
 

More from FELICIALILIANJ (7)

Artificial Intelligence and its application
Artificial Intelligence and its applicationArtificial Intelligence and its application
Artificial Intelligence and its application
 
EIK - CO4.pptx
EIK - CO4.pptxEIK - CO4.pptx
EIK - CO4.pptx
 
IP 1.pptx
IP 1.pptxIP 1.pptx
IP 1.pptx
 
Innovation and Entrepreneurship- Introduction.ppt
Innovation and Entrepreneurship- Introduction.pptInnovation and Entrepreneurship- Introduction.ppt
Innovation and Entrepreneurship- Introduction.ppt
 
upload3.pptx
upload3.pptxupload3.pptx
upload3.pptx
 
uploadscribd2.pptx
uploadscribd2.pptxuploadscribd2.pptx
uploadscribd2.pptx
 
uploadscribd.pptx
uploadscribd.pptxuploadscribd.pptx
uploadscribd.pptx
 

Recently uploaded

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 

Recently uploaded (20)

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 

Ch8-LogicalRepresentationAndReasoning.ppt

  • 3. Conjunctive Normal Form A literal is a variable or a negated variable. A clause is either a single literal or the disjunction of two or more literals. P, P  P, and P  Q  R  S are clauses. (R  S ) and P  Q are not clauses. A wff is in conjunctive normal form iff it is either a single clause or the conjunction of two or more clauses. (P  Q  R  S)  (P  R) is in cnf (P  Q  R  S)  (P  R) is not in cnf
  • 4. Conjunctive Normal Form Theorem Theorem: Every wff can be converted to an equivalent wff in conjunctive normal form. Proof: By construction: conjunctiveBoolean(w: wff) = 1. Eliminate  and  from w, using the fact that P  Q is equivalent to P  Q. 2. Reduce the scope of each  to a single term, using the facts: • Double negation: (P) = P • deMorgan’s laws: • (P  Q)  (P  Q) • (P  Q)  (P  Q) 3. Convert w to a conjunction of clauses using the fact that both  and  are associative and the fact that  and  distribute over each other.
  • 5. Conversion to Conjunctive Normal Form Let w be the wff : P  (R  Q). Then w can be converted to conjunctive normal form as follows: Step 1 produces: P  (R  Q). Step 2 produces: P  (R  Q). Step 3 produces: (P  R)  (P  Q).
  • 6. Resolution Suppose we know: winter  summer winter summer summer nil winter  summer winter  cold summer  cold
  • 7. Resolution From the premises: (P  Q) and (R  Q), Conclude: (P  R). Resolution is sound: If (P  Q) and (R  Q) are True, then: • If Q is True, R must be True. • If Q True, P must be True. Since either Q or Q must be True, P  R must be True.
  • 8. Resolution – The Algorithm To prove ST from A: 1. Convert A to a list L of clauses in conjunctive normal form. 2. Construct ST and add it to L. 3. Resolve.
  • 9. Complementary Literals A pair of complementary literals is a pair of literals that are not mutually satisfiable. So two literals are complementary iff one is positive, one is negative, and they contain the same propositional symbol. For example, Q and  Q. Choose two parent clauses that contain a pair of complementary literals. For example: C1 = R1  R2  …  Rj  Q C2 = S1  S2  …  Sk  Q. Resolve C1 and C2 to derive: R1  R2  …  Rj  S1  S2  …  Sk
  • 10. Resolution – Generating nil Consider: Q Q nil The empty clause is unsatisfiable since it contains no literals that can be made True. So if it is ever generated, the resolution procedure halts and reports that, since adding ST to A has led to a contradiction, ST is a theorem given A.
  • 11. Resolution – The Algorithm resolve-Boolean(A, ST) = 1. Construct L, the list of of clauses from A. 2. Negate ST, convert the result to conjunctive normal form, and add the resulting clauses to L. 3. Until either nil is generated or no progress is being made do: 3. 1 Choose two parent clauses. 3. 2 Resolve the parent clauses together. 3. 3 If the resolvent is not nil and is not in L, add it to L. 4. If nil was generated, a contradiction has been found. Return success. ST must be true. 5. If nil was not generated and there was nothing left to do, return failure.
  • 12. Resolution – An Example Prove R given: Given Axioms: Clauses: P P (P  Q)  R P  Q  R (S  T)  Q S  Q T  Q T T Add:  R  R
  • 13. Resolution – An Example P P  Q  R S  Q T  Q T  R P  Q  R  R P  Q P T  Q Q T T nil
  • 14. Resolution – Only Select One Pair to Resolve P  Q (1) P  Q  R (2) Prove R: P  Q  R R P  Q P  Q ? nil But is R entailed by the two facts we have been given?
  • 15. Facts in English (1) Marcus was a man. (2) Marcus was a Pompeian. (3) All Pompeians were Romans. (4) Caesar was a ruler. (5) All Romans were either loyal to Caesar or hated him. (6) Everyone is loyal to someone. (7) People only try to assassinate rulers they are not loyal to. (8) Marcus tried to assassinate Caesar.
  • 16. An Example - Facts in FOL (1) Marcus was a man. man(Marcus) (2) Marcus was a Pompeian. Pompeian(Marcus) (3) All Pompeians were Romans. x Pompeian(x)  Roman(x) (4) Caesar was a ruler. ruler(Caesar) (5) All Romans were either loyal to Caesar or hated him. x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar) (6) Everyone is loyal to someone. x y loyalto(x, y) (7) People only try to assassinate rulers they are not loyal to. x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y) (8) Marcus tried to assassinate Caesar. tryassassinate(Marcus, Caesar)
  • 17. Question Answering (1) Marcus was a man. man(Marcus) (2) Marcus was a Pompeian. Pompeian(Marcus) (3) All Pompeians were Romans. x Pompeian(x)  Roman(x) (4) Caesar was a ruler. ruler(Caesar) (5) All Romans were either loyal to Caesar or hated him. x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar) (6) Everyone is loyal to someone. x y loyalto(x, y) (7) People only try to assassinate rulers they are not loyal to. x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y) (8) Marcus tried to assassinate Caesar. tryassassinate(Marcus, Caesar) Was Marcus loyal to Caesar?
  • 18. Reasoning Backward (1) man(Marcus) (2) Pompeian(Marcus) (3) x Pompeian(x)  Roman(x) (4) ruler(Caesar) (5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar) (6) x y loyalto(x, y) (7) x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y) (8) tryassassinate(Marcus, Caesar) loyalto(Marcus, Caesar) (Marcus/x) (Caesar/y) person(Marcus) ruler(Caesar) tryassassinate(Marcus, Caesar)
  • 19. Reasoning Backward (1) man(Marcus) (2) Pompeian(Marcus) (3) x Pompeian(x)  Roman(x) (4) ruler(Caesar) (5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar) (6) x y loyalto(x, y) (7) x y person(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y) (8) tryassassinate(Marcus, Caesar) (9) x man(x)  person(x) loyalto(Marcus, Caesar) (Marcus/x) (Caesar/y) person(Marcus) ruler(Caesar) tryassassinate(Marcus, Caesar) (Marcus/x) man(Marcus)
  • 20. Functions and Predicates (1) Marcus was a man. man(Marcus) (2) Marcus was a Pompeian. Pompeian(Marcus) (3) Marcus was born in 40 A.D. born(Marcus, 40) (4) All men are mortal. x man(x)  mortal(x) (5, 6) AllPompeians died when the volcano erupted in 79 A.D. erupted(volcano, 79)  x Pompeian(x)  died(x,79) (7) No mortal lives longer than 150 years. x t1 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2) (8) It is now 2004. now = 2004 Is Marcus alive?
  • 21. Functions and Predicates (1) man(Marcus) (2) Pompeian(Marcus) (3) born(Marcus, 40) (4) x man(x)  mortal(x) (5) erupted(volcano, 79) (6) x Pompeian(x)  died(x,79) (7) x t1 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2) (8) now = 2007  alive(Marcus, now)
  • 22. Functions and Predicates - Filling in the Blanks (1) man(Marcus) (2) Pompeian(Marcus) (3) born(Marcus, 40) (4) x man(x)  mortal(x) (5) erupted(volcano, 79) (6) x Pompeian(x)  died(x,79) (7) x t2 t2 mortal(x)  born(x, t1)  gt(t2-t1, 150)  dead(x,t2) (8) now = 2007 (9a) x t alive(x, t)  dead(x, t) (9b) x t dead(x,t)  alive(x, t) (10) x t2 t2 died(x, t1)  gt(t2, t1)  dead(x, t2)  alive(Marcus, now)
  • 23. Showing that Marcus is Not Alive  alive(Marcus, now) (9a) (Marcus/x) (now/t) dead(Marcus, now) (10)(Marcus/x)(now/t2) (7) (Marcus/x)(now/t2) died(Marcus, t1) gt(now, t1) mortal(Marcus) born(Marcus, t1) gt(now-t1,150) (5) (Marcus/x) (4) (Marcus/x) (3) (40/t1) subst (79/t1) Pompeian(Marcus) gt(now, 79) man(Marcus) born(Marcus, 40) gt(now-40,150) (2) subst (1) subst T gt(2004, 79) T T gt(2007-40,150) eval eval T T
  • 24. A Harder One Given: x [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))] Roman(Isaac) hate(Isaac, Caesar) hate(Paulus, Marcus) thinkcrazy(Isaac, Paulus) Prove: know(Isaac, Marcus)
  • 25. Prenex Normal Form A sentence in first-order logic is in prenex normal form iff it is of the form: <quantifier list> <matrix>, where <quantifier list> is a list of quantified variables and <matrix> is quantifier-free. x (y ((P(x)  Q(y))  z (R(x, y, z))) is not in pnf. x y z (P(x)  Q(y))  R(x, y, z) is in pnf. Its matrix is: (P(x)  Q(y))  R(x, y, z).
  • 26. Clause Form A sentence is in clause form iff: • It has been converted to prenex normal form, • Its quantifier list contains only universal quantifiers, • Its quantifier list is no longer explicitly represented, • It is in conjunctive normal form, and • There are no variable names that appear in more than one clause. Begin with: x (P(x)  Q(x))  y (S(y)) In prenex normal form: x y (P(x)  Q(x))  S(y) In clause form: (P(x)  Q(x))  S(y)
  • 27. Clause Form Simplifies the Process x [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))] becomes: Roman(x)  know(x, Marcus)  hate(x, Caesar)  hate(y, z)  thinkcrazy(x, y)
  • 28. Conversion to Clause Form - Step 1 1. Eliminate , using the fact that a  b is equivalent to a  b x [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))] x  [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))]
  • 29. Conversion to Clause Form - Step 2 2. Reduce the scope of each  to a single term, using: •(p) = p •deMorgan’s laws •x P(x)  x P(x) •x P(x)  x P(x) x  [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))] x [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  (y z  hate(y, z)  thinkcrazy(x, y))]
  • 30. Conversion to Clause Form - Step 3 3. Standardize variables so that each quantifier binds a unique variable. x P(x)  x Q(x) x P(x)  y Q(y)
  • 31. Conversion to Clause Form - Step 4 4. Move all quantifiers to the left without changing their relative order. x [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  (y z  hate(y, z)  thinkcrazy(x, y))] x y z [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))] At this point, we have prenex normal form.
  • 32. Conversion to Clause Form - Step 5 5. Eliminate existential quantifiers through the use of Skolem functions and constants. x Roman(x) Roman(S1) x z father-of(x, z) x father-of(x, S2(x))
  • 33. Conversion to Clause Form - Step 6 6. Drop the prefix since all remaining quantifiers are universal. x y z [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))] [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]
  • 34. Conversion to Clause Form - Step 7 7. Convert the matrix into a conjunction of disjuncts by using: •Associative properties of  and . [ Roman(x)   know(x, Marcus)]  [hate(x, Caesar)  ( hate(y, z)  thinkcrazy(x, y))]  Roman(x)   know(x, Marcus)  hate(x, Caesar)   hate(y, z)  thinkcrazy(x, y) •Distributivity of  and . (P(x)  Q(x))  T(x) (P(x)  T(x))  (Q(x))  T(x))
  • 35. Conversion to Clause Form - Step 8 8. Create a separate clause for each conjunct. (P(x)  T(x))  (Q(x))  T(x)) (P(x)  T(x)) (Q(x))  T(x))
  • 36. Conversion to Clause Form - Step 9 9. Standardize apart the variables. (P(x)  T(x)) (Q(x))  T(x)) (P(x)  T(x)) (Q(y))  T(y))
  • 37. Resolution in FOL To find a contradiction, we must show that the KB, augmented with P, is unsatisfiable. Herbrand’s theorem tells us: 1. To show that a set of clauses S is unsatisfiable, it is necessary to consider only interpretations over a particular set called the Herbrand universe of S, which is the set of all ground terms constructable from the following: 1. The function symbols in S, if any. 2. The constant symbols in S, if any. If none, then the constant symbol A. 2. A set of clauses S is unsatisfiable iff a finite subset of ground instances (in which all bound variables have had a value substituted for them) of S is unsatisfiable. Resolution is an algorithm that finds contradictions without enumerating most of the Herbrand universe.
  • 38. Unification In propositional logic, it is easy to identify complementary literals such as P and P. But in FOL, what should we do about: x,y (hate(x, y)) hate(Marcus, Caesar) Or: hate(Marcus, Caesar) hate(Paulus, Caesar) Or: x,y (P(x, x)) P(Marcus, Caesar)
  • 39. Before We Start Before we consider a set of formulas and begin to reason with them, we need to standardize the variables apart: Consider: x, y Lived-In(x, y) x, y Mother-Of(x, y) Although we have used x and y in both of these formulas, the variables in these formulas are logically distinct since they occur inside the scope of quantifiers that are independent (i.e., neither lies inside the scope of the other). So an equivalent way to write these facts is: x1, y1 Lived-In(x1, y1) x2, y2 Mother-Of(x2, y2)
  • 40. Unification We need an algorithm that does two things given a sentence S and a term T: •Determine whether T matches some term T´ in S, and •Return a substitution that can be applied to the remainder of S. Example: S: x,y In(x, y)  Climate(y, moderate)  Climate(x, moderate) T: In(Italy, Europe) The process we will call unification will determine that T matches the first term of S and it will return the substitution Italy/x, Europe/y. When we apply that to the remainder of S, we have: Climate(Europe, moderate)  Climate(Italy, moderate)
  • 41. The Unification Algorithm unify-for-resolution(lit1, lit2) = If either lit1 or lit2 is a variable or a constant then: Case (checking the conditions in order and executing only the first one that matches): lit1 and lit2 are identical: return nil. /* Succeed with no substitution. lit1 is a variable that occurs in lit2: return Fail. /* These two cases implement the lit2 is a variable that occurs in lit1: return Fail. occur check. lit1 is a variable: return (lit2/lit1). lit2 is a variable: return (lit1/lit2). otherwise: return Fail. /* No match. If the initial predicate or function symbols of lit1 and lit2 are not the same, return Fail. If lit1 and lit2 do not have the same number of arguments, return Fail. substitution-list = nil. For i = 1 to the number of arguments of lit1 do Let S be the result of unify-for-resolution on the ith argument of lit1 and of lit2. If S contains Fail, return Fail. If S is not equal to nil then: Apply S to the remainder of both lit1 and lit2. Append S to substitution-list. Return substitution-list.
  • 42. The Occur Check Suppose we are trying to unify: P(x, x) P(g(x), g(x)) What happens if we skip the occur check? x and g(x) unify and yield the substitution g(x)/x. Now we must apply that substitution : g(x) g(g(x))  g(g(x)) g(g(g(x))) But if we’d standardized apart the variables before we started, this wouldn’t have been a problem.
  • 43. The Occur Check is Necessary Even with Standardizing Apart Suppose we are trying to unify: P(x, f(x), x) P(f(a), a, a) x and f(a) unify and yield the substitution f(a)/x. Applying it: f(f(a)), f(a) a, a Without the occur check, f(f(a)) and a will unify, yielding the substitution f(f(a))/a. To apply it, we must replace all a’s in the remaining terms. But that process never terminates.
  • 44. Most General Unifiers (MGUs) Suppose we are trying to prove x,y (A(x, y)  B(x, y)) Using the fact z (A(John, z)) Unifying A(x, y) with A(John, z) yields John/x, z/y. Applying it: z (B(John, z)) But we could also have matched with the substitution John/x, John/y, and been left trying to prove B(John, John), which would be harder. The algorithm we have presented always returns the most general unifier. The MGU is unique up to variable name substitution.
  • 45. Unification Examples Inputs [1] Roman(x), Roman(Paulus) [2] Roman(x), Ancient(Paulus) [3] Roman(father-of(Marcus)), Roman(x) [4] Roman(father-of(Marcus)), Roman(Flavius), [5] Roman(x), Roman(y), [6] Roman(father-of(x)), Roman(x) [7] Likes(x, y), Likes(Flavius, Marcus) Result Succeed Fail Succeed Fail Succeed Fail (fails occur check) Succeed Substitution Paulus/x father-of(Marcus)/x x/y Flavius/x, Marcus/y
  • 46. FOL Resolution – An Example Prove: Mortal(Marcus) given: x (Man(x)  Mortal(x)) Man(x)  Mortal(x) Man(Marcus) Man(Marcus) Add: Mortal(Marcus) Man(x)  Mortal(x) Mortal(Marcus) Marcus/x Man(Marcus)  Man(Marcus) nil
  • 47. FOL Resolution – the Algorithm resolve-FOL(A, ST) = Construct L, the list of clauses from A. Rename all variables in ST so that they do not conflict with any variables in L. Negate ST, convert the result to clause form, and add the resulting clauses to L. Until either nil is generated or no progress is being made do: Choose from L two (parent) clauses that contain a pair CL of complementary literals. Resolve the parent clauses together to produce a resolvent: Initially, let the resolvent be the disjunction of all of the literals in both parent clauses except for the two literals in CL. Apply to all of the literals in the resolvent the substitution that was constructed when the literals in CL were unified. Rename all of the variables in the resolvent so that they do not conflict with any of the variables in L. If the resolvent is not nil and is not already in L, add it to L. If nil was generated, a contradiction has been found. Return success. ST must be true. If nil was not generated and there was nothing left to do, return failure. ST may or may not be true. But no proof of ST has been found.
  • 48. Heuristics to Aid the Resolution Procedure •Only resolve pairs of clauses that contain complementary literals. P(x) Q(x) •Eliminate certain clauses as soon as they are generated: •Tautologies •Clauses that are subsumed by other clauses. •Set of support strategy: whenever possible resolve with a clause that is part of the statement we are trying to prove. •Unit preference strategy: whenever possible, resolve with clauses that have a single literal.
  • 49. Subsumption Clause A subsumes clause B iff B must be true in any interpretation in which A is true. (A is more general than B.) True P  Q  R  T W P  Q R  T P Q P  Q P  Q  W
  • 50. Subsumption in FOL Clause A subsumes clause B iff B must be true in any interpretation in which A is true. (A is more general than B.) True x (P(x)) P(Marcus) x(P(x))
  • 51. Using Resolution Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Painter(Rubens) Lived-In(Rubens, Europe) x,y (In(x, y)  Climate(y, moderate)  Climate(x, moderate)) Prove that Leonardo was a painter who lived in a moderate climate. Prove: y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate)) Negate it: (y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate)))
  • 52. Converting to Clause From Painter(Leonardo) Composer(Palistrina) Country(Italy) Lived-In(Leonardo, Italy) In(Italy,Europe) Climate(Europe, moderate) Painter(Rubens) Lived-In(Rubens, Europe) x,y (In(x, y)  Climate(y, moderate)  Climate(x, moderate))  In(x, y)   Climate(y, moderate)  Climate(x, moderate) (y (Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate))) y ((Painter(Leonardo)  Lived-In(Leonardo,y)  Climate(y, moderate))) Painter(Leonardo)   Lived-In(Leonardo,y)   Climate(y, moderate)
  • 53. Using Resolution 1. Painter(Leonardo) 2. Composer(Palistrina) 3. Country(Italy) 4. Lived-In(Leonardo, Italy) 5. In(Italy,Europe) 6. Climate(Europe, moderate) 7. Painter(Rubens) 8. Lived-In(Rubens, Europe) 9. Painter(Sargent) 10.  In(x, y)   Climate(y, moderate)  Climate(x, moderate) Painter(Leonardo)  Lived-In(Leonardo,y) Climate(y, moderate) Painter(Leonardo) Leonardo/x Lived-In(Leonardo, Italy)  Lived-In(Leonardo,y1)   Climate(y1, moderate) Italy/y1  Climate(Italy, moderate)
  • 54. Using Resolution 1. Painter(Leonardo) 2. Composer(Palistrina) 3. Country(Italy) 4. Lived-In(Leonardo, Italy) 5. In(Italy,Europe) 6. Climate(Europe, moderate) 7. Painter(Rubens) 8. Lived-In(Rubens, Europe) 9. Painter(Sargent) 10.  In(x, y)   Climate(y, moderate)  Climate(x, moderate) Painter(Leonardo)   Lived-In(Leonardo,y)   Climate(y, moderate) Painter(Leonardo) Leonardo/x Lived-In(Leonardo, Italy)  Lived-In(Leonardo,y1)   Climate(y1, moderate) Italy/y1  In(x, y)   Climate(y, moderate)Climate(x, moderate)  Climate(Italy, moderate) Italy/x In(Italy,Europe)  In(Italy, y2)   Climate(y2, moderate) Europe/y2 Climate(Europe, moderate)  Climate(Europe, moderate) nil
  • 55. Answering Questions A Question: Name a painter who lived in a moderate climate. ?Painter(x)  Lived-In(x,y)  Climate(y, moderate) Construct an existence statement to be proved: x, y (Painter(x)  Lived-In(x,y)  Climate(y, moderate)) Negate it and resolve, tracking the bindings:  (x, y (Painter(x)  Lived-In(x,y)  Climate(y, moderate))) x,y ((Painter(x)  Lived-In(x,y)  Climate(y, moderate))) Painter(x)   Lived-In(x,y)   Climate(y, moderate)
  • 56. Tracking the Bindings Painter(x)  Painter(x)   Lived-In(x,y)   Climate(y, moderate) Painter(Leonardo) Leonardo/x Painter(Leonardo)   Lived-In(Leonardo,y1)   Climate(y1, moderate) Lived-In(Leonardo, Italy) Italy/y1 Painter(Leonardo)   Climate(Italy, moderate)  In(x, y)   Climate(y, moderate)Climate(x, moderate) Italy/x In(Italy,Europe) Painter(Leonardo)   In(Italy, y2)   Climate(y2, moderate) Europe/y2 Climate(Europe, moderate) Painter(Leonardo)   Climate(Europe, moderate) Painter(Leonardo)
  • 57. A Reminder About Standardizing Variables Apart Prove father(Chris, Bill) given: father(x, y)  woman(x) (1) {father(x, y) woman(x)} mother(x, y)  woman(x) (2) {mother(x, y)  woman(x)} mother(Chris, Mary) (3) Add: father(Chris, Bill) father(x, y)  woman(x) mother(x, y)  woman(x) * father(x, y)  mother(x, y) mother(Chris, Mary) Chris/x, Mary/y father(Chris, Mary)
  • 58. Back to Marcus (1) man(Marcus) (2) Pompeian(Marcus) (3) x Pompeian(x)  Roman(x) (4) ruler(Caesar) (5) x Roman(x)  loyalto(x, Caesar)  hate(x, Caesar) (6) x y loyalto(x, y) (7) x y man(x)  ruler(y)  tryassassinate(x, y)  loyalto(x, y) (8) tryassassinate(Marcus, Caesar) (1) man(Marcus) (2) Pompeian(Marcus) (3) Pompeian(x1)  Roman(x1) (4) ruler(Caesar) (5) Roman(x2)  loyalto(x2, Caesar)  hate(x2, Caesar) (6) loyalto(x3, S1(x3)) (7) man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1) (8) tryassassinate(Marcus, Caesar)
  • 59. Proving Marcus Not Loyal to Caesar loyalto(M, C)  man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1) (M/x4)(C/y1)  man(M)  ruler(C)  tryassassinate(M,C) man(M) ruler(C)  tryassassinate(M,C) ruler(C) tryassassinate(M,C) tryassassinate(M,C) nil
  • 60. Does Isaac Know Marcus? Given: 1. x [Roman(x)  know(x, Marcus)]  [hate(x, Caesar)  (y (z hate(y, z))  thinkcrazy(x, y))] Roman(x)   know(x, Marcus)  hate(x, Caesar)   hate(y, z)  thinkcrazy(x, y) 2. Roman(Isaac) 3. hate(Isaac, Caesar) 4. hate(Paulus, Marcus) 5. thinkcrazy(Isaac, Paulus) Prove: know(Isaac, Marcus) * know(Isaac, Marcus)
  • 61. Does Marcus Hate Caesar? Try to prove hate(M, C): Hate(M, C)
  • 62. Try to Prove that Marcus Does Not Hate Caesar Try to prove hate(M, C): Hate(M, C)
  • 63. Try (Again) to Prove that Marcus Does Not Hate Caesar Now try to prove hate(M, C): Hate(M, C) (1) man(Marcus) (2) Pompeian(Marcus) (3) Pompeian(x1)  Roman(x1) (4) ruler(Caesar) (5) Roman(x2)  loyalto(x2, Caesar)  hate(x2, Caesar) (6) loyalto(x3, S1(x3)) (7) man(x4)  ruler(y1)  tryassassinate(x4, y1)  loyalto(x4, y1) (8) tryassassinate(Marcus, Caesar) (9) persecute(x5, y2)  hate(y2, x5) persecute(x, y)  hate(y, x) (10) hate(x6, y3)  persecute(y3, x6) hate(x, y)  persecute(y, x)
  • 64. A Winnie Example "And if anyone knows anything about anything," said Bear to himself, "It's Owl who knows something about something," he said, "Or my name is not Winnie-the-Pooh," he said. "Which it is," he added. "So there you are."
  • 65. When Does Resolution Work? Resolution is sound and refutation-complete. If there is a contradiction, resolution will eventually find it if resolvents are chosen systematically. But: •It may take exponential time. •Satisfiability is semi-decidable: if a set of clauses is satisfiable, resolution will never find a conflict and it may not notice that it is failing to do so.
  • 66. Satisfiability is Semi Decidable Suppose we want to know whether P(x) is true. There are three possibilities: (1) P(x) is entailed by KB and thus: P(x)  KB is unsatisfiable. (2) P(x) is entailed by KB and thus: P(x)  KB is unsatisfiable. (3)
  • 67. Horn Clauses A Horn Clause is a clause in which at most one literal is positive. A(x)  B(x)  C(x) becomes A(x)   B(x)  C(x) a Horn clause Deciding entailment with Horn clauses can be done in time that is linear in the size of the KB by using either backward or forward chaining.