private Chain tryCancellation(Chain c)
{
Literal head = c.getHead();
if (null != head && !(head is ReducedLiteral))
{
foreach (Literal l in c.getTail())
{
if (l is ReducedLiteral)
{
// if they can be resolved
if (head.isNegativeLiteral() != l.isNegativeLiteral())
{
Dictionary<Variable, Term> subst = unifier.unify(head
.getAtomicSentence(), l.getAtomicSentence());
if (null != subst)
{
// I have a cancellation
// Need to apply subst to all of the
// literals in the cancellation
List<Literal> cancLits = new List<Literal>();
foreach (Literal lfc in c.getTail())
{
AtomicSentence a = (AtomicSentence)substVisitor
.subst(subst, lfc.getAtomicSentence());
cancLits.Add(lfc.newInstance(a));
}
Chain cancellation = new Chain(cancLits);
cancellation
.setProofStep(new ProofStepChainCancellation(
cancellation, c, subst));
return cancellation;
}
}
}
}
}
return c;
}