diff --git a/src/plasp/pddl/expressions/Not.cpp b/src/plasp/pddl/expressions/Not.cpp index ded0f77..b406fcf 100644 --- a/src/plasp/pddl/expressions/Not.cpp +++ b/src/plasp/pddl/expressions/Not.cpp @@ -1,6 +1,8 @@ #include #include +#include +#include #include namespace plasp @@ -99,6 +101,28 @@ ExpressionPointer Not::negationNormalized() return andExpression->negationNormalized(); } + // De Morgen for existential quantifiers + if (m_argument->expressionType() == Expression::Type::Exists) + { + auto &existsExpression = dynamic_cast(*m_argument); + auto forAllExpression = ForAllPointer(new ForAll); + + forAllExpression->setArgument(existsExpression.argument()->negated()); + + return forAllExpression->negationNormalized(); + } + + // De Morgen for universal quantifiers + if (m_argument->expressionType() == Expression::Type::ForAll) + { + auto &forAllExpression = dynamic_cast(*m_argument); + auto existsExpression = ExistsPointer(new Exists); + + existsExpression->setArgument(forAllExpression.argument()->negated()); + + return existsExpression->negationNormalized(); + } + return this; }