jDREWTutorial

advertisement
0
Todays Topics

Resolution
–


j-DREW BU procedure
Subsumption
–


change to procedure
Infinite Loops
RuleML input
–
1
top down and bottom up
Prolog output
Resolution

Clausal Logic: Syntax
–
–
an atom in logic is (syntactically) a relation symbol
followed by its arguments, each of which is a term
a term is either a variable, a constant or a function
symbol followed by its arguments (which are also terms)


–
each clause is a disjunction of positive or negative atoms


–

attends(Student, Course) \/ ~passes(Student, Course)
Rule Notation: a \/ b \/ ~c \/ ~d becomes a \/ b  c /\ d
a literal is a positive or negative atom
Definite clauses have
–
2
brother(‘Harry’, future_king(‘England’))
passes(‘Fang’, cs6999)
one positive literal and any number of negative literals
Resolution

Given two clauses, to form the resolvent:
–
find two literals, one from each clause, that


–
–

–
b(X) \/ ~c(X, 3) against c(2, Y) \/ ~d(Y, Z)
gives b(2) \/ ~d(3, Z)
In rule notation
–
–
3
construct the disjunction of all literals except these two
apply the substitution
Resolve
–

can be made to match (with assignments to the variables)
differ in sign
b(X)  c(X, 3) against c(2, Y)  d(Y, Z)
gives b(2)  d(3, Z)
Bottom Up Reasoning

Single literal definite clauses are called facts
–

Resolving a fact against a condition in a rule is
called forward reasoning
–
–

so forward reasoning also called bottom up reasoning
Prolog does top-down, backward reasoning
–
4
attends(Student, Course)  passes(Student, Course)
Resolvent: attends(‘Fang’, cs6999)
Usually a derivation tree is viewed with given facts
at the bottom and derived facts at the top
–

passes(‘Fang’, cs6999)
starting from a negative clause, called a query
Theorem Prover’s Search Procedure
 Priority
–
queue
new facts
 Discrimination
trees:
–
–
5
used facts
rules, indexed on
first goal
main loop
select new fact
for each matching rule
resolve
process new result
add to old facts
process new result(C)
if C is rule
for each old fact matching first goal
resolve
process new result
add C to rules
else
add C to new facts
Preventing Infinite Loops




To prevent infinite loops in the search procedure,
use subsumption (next slides) and either
1a) use ground facts and rules only, or
1b) use no function symbols
Sometimes it helps if the positive literal has no
new variables (that do not already occur in the
body)
6
Subsumption

A clause C subsumes a clause D if there is a
substitution  such that C  D
–
–

We use subsumption between facts (atoms)
–

Atoms C subsumes atom D if
there exists  such that C = D
Subsumption is checked by
–
–
7
C is more general than D
Given C you do not need D
first grounding all variables in D to new constants
then trying to unify C with grounded D
Forward subsumption



New result is checked against old results to see if
it is more general
We can prevent some infinte loops by checking
subsumption of new fact against old facts
Should this be done when the new fact is derived
or when it is selected?
–

8
experience shows that subsumption on selection is
better
What about subsumption of rules?
Theorem Prover’s Search Procedure
 Priority
–
queue
new facts
 Discrimination
trees:
–
–
9
used facts
rules, indexed on
first goal
main loop
select new fact
if it is not forward subsumed
for each matching rule
resolve
process new result
add to old facts
process new result(C)
if C is rule
for each old fact matching first goal
resolve
process new result
add C to rules
else
add C to new facts
RuleML


Input to j-DREW BU may also
be RuleML
RuleML queries are ignored
currently
discount(customer,product1,'5.0 percent')
:premium(customer),regular(product).
10
<imp>
<_head>
<atom>
<_opr><rel>discount</rel></_opr>
<var>customer</var>
<var>product</var>
<ind>5.0 percent</ind>
</atom>
</_head>
<_body>
<and>
<atom>
<_opr><rel>premium</rel></_opr>
<var>customer</var>
</atom>
<atom>
<_opr><rel>regular</rel></_opr>
<var>product</var>
</atom>
</and>
</_body>
</imp>
Related Literature



Set of support prover for definite clauses
Facts are supports
Theorem: Completeness preserved when
definite clause resolutions are only between
first negative literal and fact.
–


11
Proof: completeness of lock resolution (Boyer’s PhD)
Use standard search procedure to reduce
redundant checking
Unlike OPS/Rete, returns proofs and uses first
order syntax for atoms
Download