A Horn clause contains at most one positive literal. A definite clause contains exactly one positive literal. Horn clauses can be used to represent implications in logic. SLD resolution is a method for determining if a set of Horn clauses entails a given goal clause by searching for a derivation through successive resolvents. Back-chaining and forward-chaining are two procedures for determining entailment of goals using a knowledge base of Horn clauses through attempting to solve subgoals.
A Horn clause contains at most one positive literal. A definite clause contains exactly one positive literal. Horn clauses can be used to represent implications in logic. SLD resolution is a method for determining if a set of Horn clauses entails a given goal clause by searching for a derivation through successive resolvents. Back-chaining and forward-chaining are two procedures for determining entailment of goals using a knowledge base of Horn clauses through attempting to solve subgoals.
positive literal. A definite clause contains exactly one positive literal. Examples of a Horn Clause
[¬Child, ¬Mail, Boy]
Not a Horn Clause
[Rain, Sleet, Snow]
Knowledge Fusion Fall 2004 1
Horn Clauses (Cont)
p1 ∧ . . . ∧ pn → q
[¬p1 , . . . , ¬pn , q]
Positive Horn Clause
Negative Horn Clause
Knowledge Fusion Fall 2004 2
Some Observations
There is a derivation of a negative clause
(including the empty clause) from a set of Horn clauses S iff there is one where each new clause in the derivation is a negative resolvent of the previous clause in the derivation and some element of S.
Knowledge Fusion Fall 2004 3
SLD Resolution Pattern
c1
c2
c3
Knowledge Fusion Fall 2004 4
SLD Resolution
For any set S of clauses, an SLD
derivation of a clause c from S is a sequence of clauses c1 , c2 , . . . , cn such that cn = c, c1 ∈ S and ci+1 is a resolvent of ci and some clause of S. We write S SLD c if there is an SLD derivation of c from S.
if S SLD [] then S []
For Horn clauses:
if S SLD [] iff S []
Knowledge Fusion Fall 2004 5
Example
Toddler
Toddler → Child
(Child ∧ Male) → Boy
Infant → Child (Child ∧ Female) → Girl Female
Query
KB |= Girl
Knowledge Fusion Fall 2004 6
Another Example: Lists
Constant nil Binary Function cons, e.g.,
cons(t1 , t2 ) Definition of Append(x,y,z) Append(nil, y, y) Append(x, y, z) → Append(cons(w, x), y, cons(w, z)) We wish to show that this entails the following:
Input: a finite list of atomic sentences, q1 , . . . , qn
Output: yes or no depending on whether a given KB entails all of the qi SOLVE[q1 , . . . , qn ] = If n = 0 then return yes For each clause c ∈ KB, do If c = [q1 , ¬p1 , . . . , ¬pm ] and SOLV E[p1 , . . . , pm , q2 , . . . , qn ] then return yes end for Return no
Knowledge Fusion Fall 2004 8
Forward-Chaining procedure
Input: a finite list of atomic sentences, q1 , . . . , qn
Output: yes or no depending on whether a given KB entails all of the qi 1. if all of the goals qi are marked as solved, then return yes 2. check if there is a clause [q1 , ¬p1 , . . . , ¬pn ] in the KB, such that all of its negative atoms ¬p1 , . . . , ¬pn are marked as solved, and such that the positive atom p is not marked as solved 3. if there is such a clause, mark p as solved and go to step 1 4. otherwise, return no