I'm implementing the specification pattern. The NotSpecification seems simple at first:
NotSpecification.IsSpecialCaseOf(otherSpecification)
return !this.specification.isSpecialCaseOf(otherSpecification)
But it doesn't work for all Specifications:
Not(LesserThan(4)).IsSpecialCaseOf(Equals(5))
This should return false instead of true. So far I think that the only way to accomplish the isSpecialCaseOf the NotSpecification is to implement the remainderUnsatisfiedBy (partial subsumption in the paper on the specification pattern). But maybe I am missing something more simple or a logical insight that makes this unnecessary.
Question: Is there another way of implementing this by not using remainderUnsatisfiedBy?