Skip to content

Commit 4f30b10

Browse files
author
ctjoreilly
committed
- minor enhancement to the Clause subsumption logic so that an unnecessary unification check is removed.
1 parent d8f6418 commit 4f30b10

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/aima/logic/fol/kb/data/Clause.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,6 @@ private boolean checkSubsumes(Clause othC,
595595
thisTerms.addAll(tl.getAtomicSentence().getArgs());
596596
}
597597
}
598-
Predicate thisPredicate = new Predicate("P", thisTerms);
599598

600599
MixedRadixNumber permutation = null;
601600
long numPermutations = 1L;
@@ -642,15 +641,14 @@ private boolean checkSubsumes(Clause othC,
642641
}
643642
}
644643

645-
Predicate othPredicate = new Predicate("P", othCTerms);
646644
// Note: on unifier
647645
// unifier.unify(P(w, x), P(y, z)))={w=y, x=z}
648646
// unifier.unify(P(y, z), P(w, x)))={y=w, z=x}
649647
// Therefore want this clause to be the first
650648
// so can do the othCVariables check for an invalid
651649
// subsumes.
652650
theta.clear();
653-
if (null != _unifier.unify(thisPredicate, othPredicate, theta)) {
651+
if (null != _unifier.unify(thisTerms, othCTerms, theta)) {
654652
boolean containsAny = false;
655653
for (Variable v : theta.keySet()) {
656654
if (othCVariables.contains(v)) {

0 commit comments

Comments
 (0)