Added second double negation elimination step after normalizing the argument of a “not” expression.
This commit is contained in:
parent
ed2d64c1c9
commit
97ad4268d7
@ -41,7 +41,7 @@ ExpressionPointer Not::normalized()
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(m_argument);
|
BOOST_ASSERT(m_argument);
|
||||||
|
|
||||||
// Remove double negations immediately
|
// Remove immediate double negations
|
||||||
if (m_argument->expressionType() == Expression::Type::Not)
|
if (m_argument->expressionType() == Expression::Type::Not)
|
||||||
{
|
{
|
||||||
auto &argument = dynamic_cast<Not &>(*m_argument);
|
auto &argument = dynamic_cast<Not &>(*m_argument);
|
||||||
@ -49,8 +49,17 @@ ExpressionPointer Not::normalized()
|
|||||||
return argument.m_argument->normalized();
|
return argument.m_argument->normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize argument
|
||||||
m_argument = m_argument->normalized();
|
m_argument = m_argument->normalized();
|
||||||
|
|
||||||
|
// Remove double negations occurring after normalizing the argument
|
||||||
|
if (m_argument->expressionType() == Expression::Type::Not)
|
||||||
|
{
|
||||||
|
auto &argument = dynamic_cast<Not &>(*m_argument);
|
||||||
|
|
||||||
|
return argument.m_argument->normalized();
|
||||||
|
}
|
||||||
|
|
||||||
// De Morgan for negative conjunctions
|
// De Morgan for negative conjunctions
|
||||||
if (m_argument->expressionType() == Expression::Type::And)
|
if (m_argument->expressionType() == Expression::Type::And)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user