}
}
// in addition, rules for negated quantifiers:
if (negated instanceof QuantifiedSentence) {
QuantifiedSentence negQuantified = (QuantifiedSentence) negated;
// I need to ensure the ~ is moved in deeper
Sentence notP = (Sentence) (new NotSentence(
negQuantified.getQuantified())).accept(this, arg);
// ~FORALL x p becomes EXISTS x ~p
if (Quantifiers.isFORALL(negQuantified.getQuantifier())) {
return new QuantifiedSentence(Quantifiers.EXISTS,
negQuantified.getVariables(), notP);
}
// ~EXISTS x p becomes FORALL x ~p
if (Quantifiers.isEXISTS(negQuantified.getQuantifier())) {
return new QuantifiedSentence(Quantifiers.FORALL,
negQuantified.getVariables(), notP);
}
}
return new NotSentence((Sentence) negated.accept(this, arg));
}